(x) => {foo: bar}

Brendan Eich brendan at mozilla.org
Mon Jan 5 11:48:53 PST 2015

Domenic Denicola wrote:
> What do you think the chances of this are in ES7+? That is, how backward-compatible is this change? The linked strawman doesn't seem to touch on `() =>  { foo: bar }` as a back-compat hazard.

The strawman discusses compatibility explicitly:



This proposal is mostly backward-compatible. In particular, the “stray 
label” problem whereby


migrates from URL contexts (links, |src| attribute values, the browser’s 
address toolbar) into script content, but not at the start of a block, 
continues to work. Note that such a “label” is not used by the statement 
or expression to which it is affixed.

Useless labels are thus allowed other than at the start of a block 
(immediately after the |*{*| that starts the block).

A block in JS today, or a block-lambda 
if that extension is supported, may be prefixed by a label and actually 
use that label, e.g. via a |break| targeting that label. The grammar 
changes above support such a label-using block(-lambda).


>   Do you feel hopeful?


How often is label-after-block-opening-left-curly used and actually 
useful? Empirical question, where did Google codesearch go? :-/. Arrows 
won't change answer much, my guess, by the time ES7 is going.


More information about the es-discuss mailing list