Expression Closures as Compliment to Arrow Functions

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Mar 23 11:23:56 UTC 2015


> On Mar 23, 2015, at 10:42 AM, Jacob Parker <jacobparker1992 at gmail.com <mailto:jacobparker1992 at gmail.com>> wrote:
> 
> I noticed expression closures, as defined below, have been excluded from the spec.
> 
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Expression_closures <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Expression_closures>
> 
> Currently implemented (and deprecated) in Firefox, which hasn't broken anything by the looks of things.
> 
> While offering little above arrow functions,

exactly

> 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/~jorendorff/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.

Allen


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150323/469f11d9/attachment.html>


More information about the es-discuss mailing list