On Jan 4, 9:31 am, Tobie Langel <tobie.lan...@gmail.com> wrote:
> Hi,
>
> There's a number of issues with the way the $super keyword is handled.
>
> Here's a proposal for something simpler and more robust... and more JS
> like:
>
> http://gist.github.com/43064
>
> Let me know what you think.

I would rather see a method for getting a reference to a "super"
method (instead of having 2 ways to call it). Something like:

var Pirate = Class.create(Person, {
  say: function(message) {
    return this.getSuper('say')(message + ', yarr!');
  }
});

Resolving "heavy" `this.constructor.superclass.prototype[methodName]`
every time seems unnecessary. If I need to call a method in a loop,
I'd rather store a method reference before entering it:

var super = this.getSuper('say');
this.children.each(function(child){
  super.call(this, child);
  // or `super(child)` if `getSuper`returns "instance-bound" reference
}, this);

Besides, `getSuper` would only clobber "class" with 1 method rather
than 2.

Am I missing any downsides?

>
> Best,
>
> Tobie

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