let me reformulate .. do you realize Object,mixing can be done runtime, so
not possible to predefine the super, and that you method fails if you have
more than a super in such form ? If not, can you write B extends A and C
extends B and use super in both C and B methods going up to A or do what my
example was doing ?

Even easier, something like this:

function A() {
  this.test('Hello!');
}
A.prototype.test = function (what) {
  alert(what);
};

function B() {
  this.super();
}
B.prototype = poo.inherit(A.prototype);
B.prototype.constructor = B;
B.prototype.test = function (what) {
  this.super(what);
};

poo.superable(B.prototype);

new B;
// will alert Hello! dong these steps:
//  1. invokes B.prototype.constructor which
//  2. invokes A.prototype.constructor which
//  3. invokes B.prototype.test which
//  4. invokes A.prototype.test





On Fri, Mar 8, 2013 at 7:20 PM, Andrea Giammarchi <
[email protected]> wrote:

> does that work runtime with more than one super ?
>
>
> On Fri, Mar 8, 2013 at 7:13 PM, Axel Rauschmayer <[email protected]> wrote:
>
>> Now, how transpilers are going to solve Object.mixin super call? 'cause
>> once again, that should be solved runtime and I am curious, without caller,
>> how transpilers are thinking to solve that.
>>
>>
>> You can do the following:
>>
>>     SubClass.prototype.foo = function me(x) {
>>         var ssuper = me.homeObject.__proto__;
>>         return 1 + ssuper.foo.call(this, x);
>>     };
>>
>> Additionally, one would have to make the following assignment for each
>> method m of SubClass.prototype:
>>
>>     SubClass.prototype.m.homeObject = SubClass.prototype;
>>
>> Rationale: a method needs to be aware of its (static) position in the
>> prototype chain if it wants to make a proper super-reference.
>>
>> More information: http://www.2ality.com/2011/11/super-references.html
>>
>>         --
>> Dr. Axel Rauschmayer
>> [email protected]
>>
>> home: rauschma.de
>> twitter: twitter.com/rauschma
>> blog: 2ality.com
>>
>>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to