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

Brendan Eich brendan at
Thu Sep 11 12:49:52 PDT 2008

On Sep 11, 2008, at 12:11 PM, Jon Zeppieri wrote:

> var foo = function bar(x) { ... bar(y) ... }
> ... works fine, so long as bar isn't shadowed in the function body.
> The programmer can change the public name ("foo") to anything else
> without worrying about breaking recursive call sites inside the
> function.  (In this case, it happens to be considerably terser than
> arguments.callee, too.)

The only drawback is ES3.1's flawed specification of this named  
function expression binding using a new Object. But this is being  
fixed in any proposed new edition.

Without the fix, named function expressions are noticeably slower to  
evaluate in common implementations.

> Recursion isn't the only possibility here.  Higher-order use of the
> callee -- i.e., returning it, passing it to another function -- is
> also possible and is handled correctly by the idiom above.

Sure, that's why it was added (IIRC -- my participation in ES3 was  
limited). Even then the carrot of a better new form was used to try  
to get people off of arguments.callee (which was in ES1).

We need more carrots, fewer sticks.

> Are there uses of arguments.callee that can't be handled this way?

No. The problem is simply that arguments.callee is used all over the  


More information about the Es-discuss mailing list