name anonymous functions on property assignments

T.J. Crowder tj.crowder at farsightsoftware.com
Fri Jan 6 14:43:21 UTC 2017


If no one can remember what the objection was / objections were, I
might submit a proposal to close the gap. I'm not a spec expert in any
way, but I *think* it's simply a matter of removing the
IsIdentifierReference check in Step 1.e of [assignment
evaluation](http://www.ecma-international.org/ecma-262/7.0/index.html#sec-assignment-operators-runtime-semantics-evaluation).

-- T.J.

On Tue, Dec 13, 2016 at 9:03 AM, T.J. Crowder
<tj.crowder at farsightsoftware.com> wrote:
> About a year ago, Bergi asked[1] why no name is assigned to a function
> when it's created as part of an assignment to an object property:
>
> o.method = () => { };
>
> Allen Wirfs-Brock replied:
>
>> We did not have consensus on doing the same for:
>> `MemberExpression.IdentifierName = FunctionExpression` or
>> `MemberExpression[Expression] = FunctionExpression`
>> so it is not part of ES2015. There were various objections that would have
>> to be overcome before we could adopt that.
>
> Does anyone remember what the objections were?
>
> I've been through the TC39 meeting notes[2] without luck (so far). In
> the May 28 2015 notes I can find "function name property" listed as an
> open issue, but nothing in the May 29 notes and those are the last two
> in the "es6" folder. Other than those, searching for "function name"
> in meeting notes turns up Mar 24 2015, then Nov 18 2014, then July 23
> 2013; that last one talks about doing inference (as a whole) and AWB
> says "It's not an insignificant amount of work" suggesting to me that
> at that point, it hadn't been done yet. But Nov 18 2014 and Mar 24
> 2015 don't seem to address this case. Other mentions of "function
> name" are unrelated (for instance, relate to `toString`). Searching
> for "MemberExpression" only turns up one unrelated match.
>
> The strawman[3] (linked from the July 23 2013 notes) does have the
> name being set in this case (it's the final example).
>
> Thanks,
>
> [1] https://esdiscuss.org/topic/name-anonymous-functions-on-property-assignments
> [2] https://github.com/rwaldron/tc39-notes
> [3] http://wiki.ecmascript.org/doku.php?id=harmony:function_name_property
>
> T.J.


More information about the es-discuss mailing list