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

liorean liorean at gmail.com
Thu Sep 11 12:56:21 PDT 2008


2008/9/11 Jon Zeppieri <jaz at bu.edu>:
> I imagine the appeal of arguments.callee comes from the fact that it
> allows programmers to rename functions without having to change
> recursive calls within the body of the function.  Leaving aside the
> matter of how onerous this renaming actually is, the ability to have
> an outer, public name, as well as an inner, private one already exists
> in ES3:
>
> var foo = function bar(x) { ... bar(y) ... }
>
> ... works fine, so long as bar isn't shadowed in the function body.

Does not quite work on the current web - JScript binds the "bar" name
in the containing scope, not the contained scope as ES3 specs it. That
means the inner name isn't really usable for recursion unless the
script author actually makes sure it stays unmodified in the
containing scope.

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

Except for the JScript bug, none that I can think of straight off the
top of my head.
-- 
David "liorean" Andersson


More information about the Es-discuss mailing list