Expression Closures as Compliment to Arrow Functions

Brendan Eich brendan at
Mon Mar 23 15:37:28 UTC 2015

Allen Wirfs-Brock wrote:
>> including these, in addition to the existing shorthand syntaxes, 
>> should make the following examples work.
>>     var x = { value: 3, toString() 'string', valueOf() this.value };
>>     class x { constructor { this.value = 3; } valueOf() this.value }
> what you show above would be an expression bodied "concise method" 
> <> That’s 
> a different beast from a FF “expression closure”.
> These were consider but not adopted for ES6.  Primarily because they 
> introduced grammar, ASI and/or other issues that at the time didn’t 
> see worth trying to solve.

To be precise, the full `function (args) expr` form inverts precedence, 
creating fatal ambiguity. Here's an example from the old thread on an 
equvalent problem that afflicted ES4's let expressions:

function f() {return "f"}
var x = 3;
var y = function (a) a ? f : x++(1);

This should print "f" but it instead prints function f converted to a 

Expression closures are dead, IMHO. Even though the variant in object 
literals could be supported.


More information about the es-discuss mailing list