A new function name property proposal
jorge at jorgechamorro.com
Fri Nov 23 02:12:38 PST 2012
On 22/11/2012, at 09:38, Brendan Eich wrote:
> 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.
To clarify, I wasn't trying to justify arguments.callee.
"don't do that" is a solution, for this and for many other WTFs and footguns...
But, isn't the NFEs' way the Right Way to do it?
Do we want this footgun in function declarations?
Is there any reason for not removing it? (Other than "because it's a corner case"?)
More information about the es-discuss