Block Lambdas: break and continue

Allen Wirfs-Brock allen at
Mon Jan 16 11:32:23 PST 2012

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

> With completion values as In ES1-5, not even depending on, it might be enough to say:

You're right, according to ES 5 semantics this does provide "early" as the value of the labelled block.

>    foo  {||
>        exit: {
>             ...
>             if (...) {
>                 "early";
>                 break exit;
>             }
>             ...
>         }
>    }
> IINM this would work. Sugaring it using 'with' looks nice -- always tempting to re-use 'with'.

and if fact it does work in the browsers I tested (without the block lambda), so I was wrong when I said there was no way to supply the completion value. But the sugaring is much more explicit.

> 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

> /be

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

More information about the es-discuss mailing list