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" http://people.mozilla.org/~jorendorff/es6-draft.html#sec-method-definitions <http://people.mozilla.org/%7Ejorendorff/es6-draft.html#sec-method-definitions> 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);
print(y);

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

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

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to