name anonymous functions on property assignments

Benjamin Gruenbaum benjamingr at
Sun Jul 26 20:12:02 UTC 2015

I just want to point out that Bergus (OP) informed me that the assignment
behavior happens in computed object literal keys. So:

let o = {
     ["fn" + "name"] () {}
}; // fnname

On Sun, Jul 26, 2015 at 10:55 PM, Andrea Giammarchi <
andrea.giammarchi at> wrote:

> with all due respect Allen, I'm completely against magic-function-name
> assignment for various reason and leaking ain't one.
> What could you assign in ES6 that cannot be retrieved anyway through
> getOwnPropertySymbols and getOwnPropertyNames ? A triple-magic private
> Proxy handler or what?
> I mean, the moment you could access that method is the moment it could
> leak with or without a name, right?
> Just curious about what you had in mind, again I agree having this in is a
> no-go.
> Best Regards
> On Sun, Jul 26, 2015 at 8:48 PM, Allen Wirfs-Brock <allen at>
> wrote:
>> On Jul 26, 2015, at 5:11 AM, Benjamin Gruenbaum wrote:
>> > In theory this sounds like a cool idea, I didn't even know variable
>> assignments named functions.
>> >
>> > The only issue I see here is how we're now differentiating assignment
>> by where it happens - what if the property is computed? As far as I know
>> function names are more constrained (like variable names) in what they can
>> be. Object properties may contain characters that function names may not.
>> the possibility that the property key is a symbol is a primary reason
>> that this expression form does not set the `name` property.
>> There may also be security concerns.  The `name` property potentially
>> leaks via the function object the name of the variable it is initially
>> assigned to.  But there isn't much someone could do with a local variable
>> name, outside of  the originating function.  But a leaked property name
>> potentially carries a greater capability.
>> Allen
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list