Super-references

Andrea Giammarchi andrea.giammarchi at gmail.com
Fri Mar 8 19:20:07 PST 2013


does that work runtime with more than one super ?


On Fri, Mar 8, 2013 at 7:13 PM, Axel Rauschmayer <axel at rauschma.de> 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
> axel at rauschma.de
>
> home: rauschma.de
> twitter: twitter.com/rauschma
> blog: 2ality.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130308/5d6929f5/attachment-0001.html>


More information about the es-discuss mailing list