Hi Allen,

> I think you need "this.nifty.$super.call(this, foo);"

You don't, although that also works.  A named function's name is in
scope within the function:

    function foo(bar) {
        alert(typeof foo); // Alerts "function"
    }

However, I was thinking about anonymous functions this morning while
waking up (pathetic, isn't it?) and realized that even if you don't
use a named function, you can avoid arguments.callee with exactly the
form you describe:  this.nifty.$super.call(this, foo);  I don't like
the repetition of "this", but if you don't have time to switch
everything over to named functions (I'm thinking of retrofitting
efforts), it's a reasonable first step, and I assume (haven't tested
it yet) still gets speed gains over arguments.callee.

Will be posting a sample implementation (it's wonderfully simple, but
there are a couple of edge cases around dynamic updates of classes)
and tests ASAP, but I want to get some of the Prototype documentation
issues sorted out first (transferring the old doc to the new format
and updating), since that's more urgent.

-- T.J. :-)

On Sep 5, 2:46 pm, Allen Madsen <bla...@gmail.com> wrote:
> > >     var Thingy = Class.create({
> > >         nifty: function nifty(foo, bar) {
> > >             nifty.$super.call(this, foo);
> > >         }
> > >     });
>
> > > It just ignores the function name and complains that 'nifty' is not
> > > defined.  This works:
>
> I think you need "this.nifty.$super.call(this, foo);"
>
> Allen Madsenhttp://www.allenmadsen.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
prototype-core-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to