name anonymous functions on property assignments

a.d.bergi at web.de a.d.bergi at web.de
Tue Jul 28 18:13:11 UTC 2015


> Just saying that an exposed property name is a different (and potentially more broadly exploitable) capability than exposing a local variable name.
> 
> TC39 reached consensus on automatically assigning the `name` property for expression forms like:
>       Identifier = FunctionExpression
> and so it is part of ES2015.  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.

Ah, that's what I wanted to know. Can you detail these objections, please? Or link to the TC39 notes where these were discussed?

I see that method names are more capable than local variable names, but aren't we already naming methods by default everywhere else? Even those with computed keys?
To me, there is not much difference between

    let o = {
        method: () => {…}
    };

and

    let o = {};
    o.method = () => {…};

yet the first function gets a name while the second one doesn't.

 Bergi


More information about the es-discuss mailing list