arrow function syntax simplified

Claus Reinke claus.reinke at
Wed Mar 28 07:42:49 PDT 2012

> The ambiguity between a block body and an object literal expression body,
> which we would prefer to resolve in favor of object literal. The solutions
> considered before this edit were:
> *
> * Two-token lookahead restriction per 
> Both are hairy and not near consensus in TC39. The first isn't backward-
> compatible on edge cases that probably exist on the web. The second is
> future-hostile.

An alternative suggestion was to default to object, but to use an empty
statement prefix to get an unambiguous block {; ..}. Then, we'd have

- statement context: default to block, use parens ({..}) to get object
- expression context: default to object, use empty statement {;..} to get 

{; ..} might be a notation-alternative to do-expressions, saving a valuable
keyword. This would require compatible completion-value semantics.


More information about the es-discuss mailing list