Block Lambdas: break and continue

Axel Rauschmayer axel at
Sat Jan 14 12:35:38 PST 2012

> If I understand your suggestion, you're proposing that non-local break and continue should be exposed as standard exceptions, and then implementors of loop-like abstractions could choose to catch them.
> ...
> Did I understand your suggestion correctly?

Yes. I was thinking about the BGGA closure proposal that Allen also linked to:

> This *may* not violate TCP (I'm not quite sure), but I'm not enthusiastic about the idea. The semantics is significantly more complicated, and it requires you to understand whether a higher-order function like forEach is catching these exceptions or not. So it becomes an additional part of the API of a function. If someone doesn't document what they do with BreakException and ContinueException, then writing callbacks you won't actually be able to predict what `break` and `continue` will do.

I don’t think it’s a must-have, but whenever you catch exceptions, you have similar issues.

Dr. Axel Rauschmayer
axel at


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list