Block Lambdas: break and continue

David Herman dherman at mozilla.com
Mon Jan 16 14:44:08 PST 2012


On Jan 16, 2012, at 11:09 AM, Brendan Eich wrote:

> With completion values as In ES1-5, not even depending on http://wiki.ecmascript.org/doku.php?id=harmony:completion_reform, it might be enough to say:
> 
> 
>    foo  {||
>        exit: {
>             ...
>             if (...) {
>                 "early";
>                 break exit;
>             }
>             ...
>         }
>    }

Yeah, I thought of that too, although it's unfortunately awfully obscure. It was also the motivation behind http://wiki.ecmascript.org/doku.php?id=strawman:return_to_label

> IINM this would work. Sugaring it using 'with' looks nice -- always tempting to re-use 'with'.

A clever idea, and more pleasant-looking than the syntax of my old return_to_label strawman. But it does have an ASI hazard:

    break exit
    with "early"

That might be what /be meant by:

> I have some angst about loss of a hunk of code running "break L" up against " with (E)\nS" where E is an expression and S is a statement and the two came from a bone-fide with statement later in the unmangled source.

Dave

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/9256a2e5/attachment.html>


More information about the es-discuss mailing list