(x) => {foo: bar}
Brendan Eich
brendan at mozilla.org
Mon Jan 5 12:05:23 PST 2015
Frankie Bagnardi wrote:
> That's good news, thanks for the strawman link. Is it correct to
> assume this with that proposal?
>
> var f = (x) => (y) => {x, y};
> f(1)(2) // => {x: 1, y: 2};
Good point, the strawman does not take object literal shorthand into
account and indeed parses {x, y} in an expression context as a block
expression, not an object literal. More work needed, it was only straw :-P.
To clarify something Caitlin raised: the goal is to enable block
expressions everywhere, and unify arrow function body on an expression
nonterminal, eiminating ConciseBody (in ES6) or the two production
right-parts in
ArrowFunctionExpression :
ArrowFormalParameters => [lookahead ∉ { "{" }] AssignmentExpression
ArrowFormalParameters => Block
from
http://wiki.ecmascript.org/doku.php?id=harmony:arrow_function_syntax
/be
More information about the es-discuss
mailing list