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

Jon Zeppieri jaz at bu.edu
Thu Sep 11 15:40:38 PDT 2008


On Thu, Sep 11, 2008 at 5:59 PM, Peter Michaux <petermichaux at gmail.com> wrote:
> On Thu, Sep 11, 2008 at 12:11 PM, Jon Zeppieri <jaz at bu.edu> wrote:
>
> [snip]
>
>> 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.
>
> It makes recursive calls inside anonymous functions possible.

No.  See "fixpoint combinator."

But that's a somewhat flippant response.  More to the point: if you
want recursion, one way or another, you need to be able to refer to
the function in question.  'arguments.callee' allows you to refer to
it but violates the Tennent Correspondence.  So, given that you can
either refer to the function this way:

var foo = bar() { ... bar ...}

   or this way:

function bar() { ... arguments.callee ... }

... it's not clear to me what advantage the latter has over the former
(IE bugs aside, that is).  Anonymity itself doesn't seem to be a
virtue.

-Jon


More information about the Es-discuss mailing list