(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:

http://wiki.ecmascript.org/doku.php?id=strawman:block_vs_object_literal#compatibility

"""

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

javascript:foo()

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 
<http://wiki.ecmascript.org/doku.php?id=strawman:block_lambda_revival> 
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?

Reasonably.

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.

/be


More information about the es-discuss mailing list