Block Lambdas: break and continue

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jan 17 09:52:54 PST 2012


On Jan 16, 2012, at 2:16 PM, Brendan Eich wrote:

> ...
> 2. Variation on empty label: support "do" as a reserved-identifier label that is implicitly addressed by break; and continue; (no labels on the break and continue). A little Smalltalk homage and not so visually nasty and potentiailly confusing as empty label.
> 
>   do: arr.forEach {|o|
>     if (...) break;
>     ...
>   }


do: arr.alternate ({|o| if (...) continue; if (...) break; ...}, {|o| if (...) continue; ...});

I don't see how this can support the most likely intended semantics:
do:arr.alternate (:{|o| if (...) continue; if (...) break do); ...}, : {|o| if (...) continue; ...});

might, but ugly

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120117/df1afe79/attachment.html>


More information about the es-discuss mailing list