name anonymous functions on property assignments

Allen Wirfs-Brock allen at wirfs-brock.com
Sun Jul 26 19:48:15 UTC 2015


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


More information about the es-discuss mailing list