Ye olde arguments argument (was: Topic list - pending changes and issues for the ES3.1 spec)

Brendan Eich brendan at mozilla.org
Mon Sep 15 14:23:15 PDT 2008


On Sep 15, 2008, at 10:13 PM, Jorge Chamorro wrote:

> El 15/09/2008, a las 22:32, Jon Zeppieri escribió:
>
>>> IOW, could we have instead a ('standalone') 'callee' property (that
>>> isn't to be innocently passed on) ?
>>>
>>
>> ...as a property of what?
>
> The activation object of the execution context.

I've been there, done that. Long ago, when crazy Smalltalk-ish  
reflection of execution state was in vogue, SpiderMonkey grew magic  
reflective properties (ugly names, such as __caller__). The compiler  
would make functions enclosing such things always have an activation  
object (real implementations must optimize away activation objects  
for performance -- there's no other way).

Besides violating Tennent's Correspondence Principle, this was an  
evil mess to implement correctly (consider all the optimizations that  
had to be undone). It's not worth it, especially if you want just  
callee (use a named function expression, or bind an outer lexical  
name) or caller (stack inspection should be served by a carefully  
designed API on the side -- "mirror" reflection, not an API on  
activation objects).

I agree with Mark about callee. Just say no, if we can wean folks off  
of it.

Stack backtracing deserves a separate thread.

/be



More information about the Es-discuss mailing list