(x) => {foo: bar}

Brendan Eich brendan at mozilla.org
Tue Jan 6 14:44:36 PST 2015


Marius Gundersen wrote:
>
> I don't see how wellLabeledStatement will protect against object 
> literals with shorthand properties, like (x, y, z) => {x, y, z}.
>
> The solution to the block vs object problem today is to wrap the 
> object in parenthesis, but not the block. The only alternative that is 
> easy for humans to understand and not ambiguous for machines is to 
> wrap or prefix the block, but not the object, for example with do:
>
> x => do {
>   let a = 5;
>   return a*x;
> }
>
> AFAIK do expressions are not in ES6, but might be in ES7.
>

do-expressions are in good shape for ES7, stage 2 or better IIRC. I 
can't find a record of this at the moment, but perhaps arossberg has a link.

/be


More information about the es-discuss mailing list