Conditional catch clause

David Bruant bruant.d at
Wed Dec 19 08:04:58 PST 2012

Le 19/12/2012 16:45, Brandon Benvie a écrit :
> Another benefit is in not polluting the stack trace for actual errors, 
> which is actually a pretty big annoyance now for control flow 
> try...catch wrappers like for of shims.
This is making me realize that maybe the language needs a third way to 
end a frame. This third way wouldn't propagate as throw does but would 
be used only as a communication mechanism between the engine and a 
user-defined function.
Maybe "break"?

In an iterator, one would express "break StopIteration" to stop the 
iteration. In a .forEach, one would write "break StopIteration" to stop 
the iteration.
What I'm describing might be violently backward incompatible (and 
doesn't behave well inside switch statement and in cases where there are 
labels), but I find the thought experiment interesting.


More information about the es-discuss mailing list