Skip to content

Comment on Safe Assignment

Comments

Is try really meant for casual flow control, or should it be last ditch error recovery? ?: makes sense, forEach() makes sense, but not every kind of block needs a backup syntax.

That will depend on language features (for example, multilevel/labelled `break`), performance (exceptions may or may not be slow or interfere with some kinds of optimizations), and personal preference (similar to the disagreement over whether or not it's bad practice to allow multiple `return` statements in one procedure).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.