Proposal: expression mode (=)

Yongxu Ren renyongxu at
Mon Oct 31 20:10:43 UTC 2016

The reason for `=` instead of the `do expression` is to write functional
code without extra syntax. I do not think there are any indistinguishable
or 'very confusing' case, though I am aware the *Object Property Shorthand`
that been introduced in ES6 might cause some problems.

Here is what I think that may resolve this problem
for your concern,
var b = 1
var a = b
= { c }

the solution is to make `Object literals` to have higher parsing priority.

if `c` is a variable, it will be parsed as `object literal`, otherwise it
is considered as scope and been parsed as expression block.

`var x = { a }` will be parsed as `var x = { a: a }`
`var x = { a() }` will be parsed as `var x = a()`, under current specs it
would be syntax error.

In this case, this proposal should not cause any confusion IMO.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list