arguments.callee in Harmony

Brendan Eich brendan at mozilla.com
Thu Sep 24 16:26:02 PDT 2009


On Sep 24, 2009, at 4:06 PM, Charles Jolley wrote:

> I'm curious, why not just give anonymous functions a default name  
> like "callee".  Or perhaps have "callee" defined in a function scope  
> to represent the function?  That seems to be exactly the same as the  
> above; it just makes it easier for developers.  Is there a perf  
> issue here?

No, there's simply a backward compatibility problem. Anonymous  
functions do not inject any such name on the scope chain (in any  
object, new or expected, on the scope chain). Changing the language to  
inject callee (even in an ES5 declarative envirnment frame) is not  
backward compatible and probably will break some content out there  
that uses callee in an outer scope to mean something else.

/be


More information about the es-discuss mailing list