Block Lambdas: break and continue

Brendan Eich brendan at mozilla.org
Mon Jan 16 11:39:36 PST 2012


> Allen Wirfs-Brock <mailto:allen at wirfs-brock.com>
> January 16, 2012 11:32 AM
>
> On Jan 16, 2012, at 11:09 AM, Brendan Eich wrote:
>> 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.
>
> that's why I would require a [no LineTerminator here] before the with 
> clause of a break statement

Right, got that -- it's why I wrote "unmangled". Sorry to be unclear. 
I'm supposing code of this form

    foo  {||
        exit: {
             ...
             if (...) {
                 "early";
                 break exit
             }
             ...
         }
    }
    ...
    with (O)
        S;


got mangled into code of this form:


    foo  {||
        exit: {
             ...
             if (...) {
                 "early";
                 break exit
    with (O)
        S;

and all braces still matched -- and then a newline was lost. Yes, it's 
unlikely and minifiers must ensure semicolons are inserted, etc. Still a 
source of angst because the bad thing might go undetected.

If block-lambdas require version opt-in, then of course 'with' 
statements are early errors. That helps, but break L with E would be a 
general statement form, IIUC, so not just for block-lambdas. We'd have 
to say this new syntax requires version opt-in (something I'm arguing 
against in reply to Andreas R.).

Sorry to make a small hill out of a mole hill -- not my intention, but 
my angsty spider-sense is tingling when 'with' makes come-backs of this 
kind...

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/e83187b8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1293 bytes
Desc: not available
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/e83187b8/attachment.jpg>


More information about the es-discuss mailing list