A new function name property proposal

Brendan Eich brendan at mozilla.org
Thu Nov 22 00:38:14 PST 2012


Brandon Benvie wrote:
> I don't know the specific reasoning behind it. I guess the idea is 
> that a function is declared in a maximum of one scope. For the 
> declaration it's the outer scope, for a named function expression it's 
> a static scope that sits between the outer scope and the (during 
> execution of the function) inner scope.
>
> Also just to clarify, the above isn't something I'm proposing. It's 
> how things currently work.

Right. I think Jorge may be concerned that naming a function does not 
always relieve the "need" for arguments.callee. But that's only true in 
a function declaration, which is inherently named, as you showed -- and 
only if one then overwrites the name in its scope.

So don't do that. Fear that someone else might means you are in the 
global scope, which means that instead of using such a hard case to 
justify arguments.callee, you ought to modularize with an IIFE or (in 
due course) ES6 module.

/be


More information about the es-discuss mailing list