>
> _I_ happen not to like it.
>

I highly doubt anyone really likes it too much.



On Mon, Jan 5, 2009 at 12:43 AM, Tobie Langel <tobie.lan...@gmail.com>wrote:

>
> FWIW $super is *not* gone.
>
> _I_ happen not to like it.
>
> On Jan 5, 2:44 am, kangax <kan...@gmail.com> wrote:
> > On Jan 4, 7:12 pm, Tobie Langel <tobie.lan...@gmail.com> wrote:
> > [...]
> >
> > > On the other hand, you'd have to handle this like so with your
> > > proposed implementation:
> >
> > > var Child = Class.create(Parent, {
> > >   doStuff: function() {
> > >     return this.getSuper('doStuff').apply(this, arguments) + ' extra
> > > stuff';
> > >   }
> >
> > > });
> >
> > > Which is a lot less elegant imho.
> >
> > It is, no doubt, less elegant when passing `arguments` object along.
> > It's, nevertheless, dead simple when working with actual named
> > arguments.
> >
> > var Child = Class.create(Parent, {
> >   doStuff: function(foo) {
> >     return this.getSuper('doStuff')(foo);
> >     // looks just as "elegant" as:
> >     return this.callSuper('doStuff', foo);
> >   }
> >
> > });
> >
> > I understand that "slicing" arguments into an actual array is not
> > pleasant, but isn't it something irrelevant to "super" implementation?
> > Now that `$super` as a first argument is gone, I don't see why it
> > would be common to "slice(1)" arguments object. Having a reference to
> > super method on the other hand gives a freedom to do anything you
> > would do with a regular Function object - call, apply, bind, etc. I
> > think requesting a reference to a function object is as
> > "javascriptish" as it gets : )
> >
> > `this.getSuper('doStuff').apply(this, arguments)`
> > is clearly not as nice as a special-cased:
> > `this.applySuper('doStuff', arguments);`
> >
> > It seems like a too minor annoyance to worry about, but if many will
> > find it useful - sure - let's add it.
> >
> > [...]
> >
> > Class.Base = Class.create({
> >   getSuper: function(methodName) {
> >     return this.constructor.superclass.prototype[methodName].bind
> > (this);
> >   }
> >
> > });
> >
> > var Person = Class.create(Class.Base, {
> >   initialize: function(name) {
> >     this.name = name;
> >   },
> >   say: function(message) {
> >     return this.name + ': ' + message;
> >   },
> >   say2: function(){
> >     return this.name + ': ' + Array.prototype.join.call(arguments, '
> > ');
> >   }
> >
> > });
> >
> > var Pirate = Class.create(Person, {
> >   say: function(message) {
> >     return this.getSuper('say')(message + ', Argh!');
> >   },
> >   say2: function() {
> >     return this.getSuper('say2').apply(null, arguments) + ', Argh!'
> >   }
> >
> > });
> >
> > (new Pirate('Joe')).say('Hi');
> > (new Pirate('Joe')).say2('Hi', 'Bye');
> >
> > --
> > kangax
> >
>


-- 
Ryan Gahl
CEO
Nth Penguin, LLC
http://www.nthpenguin.com
--
WebWidgetry.com / MashupStudio.com
Future Home of the World's First Complete Web Platform
--
Inquire: 1-920-574-2218
Blog: http://www.someElement.com
LinkedIn Profile: http://www.linkedin.com/in/ryangahl

--~--~---------~--~----~------------~-------~--~----~
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