(x) => {foo: bar}

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Jan 7 11:28:52 PST 2015

On Jan 6, 2015, at 5:34 PM, Gary Guo wrote:

> I found that even without shorthand, the object literal can still be ambiguous with block.

Yes, but not in the context of a ConciseBody of an ArrowFunction.

The grammar for ConciseBody (http://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions ) ensures that there is no ambiguity. If a ConciseBody starts with a { then it must parse as either a well-formed bracketed FunctionBody or as a syntax error.

There is no guessing. { means statements follow rather than an expression.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150107/1f1d5be5/attachment.html>

More information about the es-discuss mailing list