"Pretty" function expression names
Mike Wilson
mikewse at hotmail.com
Mon May 4 12:12:43 PDT 2009
Mark Miller wrote:
> On Mon, May 4, 2009 at 11:12 AM, Michael <Michael at lanex.com> wrote:
> > From what I understand arguments.callee is going away. If
> > that is the case,
> > then from within that function how would I call it?
> >
> > function "my description here" () {
> > ...
> > "my description here"(foo)
> > };
> >
> > That doesn't seem right, but maybe I'm overlooking something.
>
> Indeed. PT's original example was:
>
> > var myFun = function "my description here" (...) { ... };
>
> in which case you could call it as
>
> myFun(foo)
I think Michael was referring to the fact that you can supply
a local identifier on function literals, that can only be used
inside the function body, typically used for recursion:
var myFun = function x() { x() };
This enables recursion independently of what external identifier
the function is bound to, just like arguments.callee does.
Best regards
Mike Wilson
More information about the es-discuss
mailing list