Hi, I think the speed improvement definitely merits going into. I would suggest the helper be called $super so when converting, the relationship is evident. I have to admit that passing arguments in feels odd to me though.
Allen Madsen http://www.allenmadsen.com On Fri, Sep 4, 2009 at 9:09 AM, T.J. Crowder <t...@crowdersoftware.com> wrote: > > Hi Richard, > > Thanks for that. > > I like the terseness and clarity of this.base() although I'd have > concerns about that making it difficult for people to retrofit their > classes ("base" being a fairly common word). I do _not_ mean that I > think "callSuper" is a great name; I don't and I expect suggestions > like yours to result in a better name. But something unlikely to > clash makes it simpler for people to do a global search-and-replace to > convert $super(...) to this.niftyNameHere(arguments, ...). Even in a > large project, that should be a 10-minute exercise. > > Agreed that both mechanisms can co-exist, except that I -- perhaps > unreasonably -- find running all of the subclass methods through > Function#toString at definition time ugly. But you're right, once > deprecated the old $super could be supported for a dot rev or so to > ease transition. > > I meant to mention in my earlier post that once implementations have a > native Function#bind (which I'm sure everyone knows is in the latest > ECMA draft specs), presumably the cost of that bind-on-each-method- > call would go down, though I suspect it will never reduce to zero. > -- > T.J. Crowder > tj / crowder software / com > www.crowdersoftware.com > > > On Sep 4, 1:53 pm, Robert Kieffer <bro...@gmail.com> wrote: > > Hey gang, > > > > I took a look at this issue a while ago, in a blog post that generated a > > fair bit of discussion and spin off investigations (seehttp:// > www.google.com/search?q=inheritance+performance+javascript) so I'll > > try to weigh in. However I'm in the middle of an extended road trip, so > I > > don't have the time/resources necessary to give this proper attention... > > > > http://ejohn.org/blog/simple-javascript-inheritance- JQ's swipe at this > > problem. Definitely read through the comments. Your approach appears > > similar to his (which is based on Dean Edward's Base2). Dean uses > > this.base(), instead of this.callSuper(), fwiw. no strong opinions > there, > > although this.base() seems a bit more "prototype-like" in it's terseness. > > > > The performance tests I did for Base2 (see the broofa.com article in the > > google search above) are probably a good first-guess at the performance > your > > approach will have compared to other techniques. > > > > Technically this doesn't break backward compatibility - $super and > > this.callSuper() can coexist as dual techniques for doing inheritance, > > correct? We just need to decide if $super support will continue in P2. > > > > ... and, finally, I vaguely recall people raising some interesting edge > > cases. But I don't remember where I saw those. *sigh*. > > > > - rwk > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---