Axel Rauschmayer axel at rauschma.de
Tue Nov 15 06:04:38 PST 2011

AFAIKT, your way of super-calling won’t work:
- When starting at the instance you skip the instance’s prototype.
- During each recursive call, you advance one object in the prototype chain. That won’t work if a super-method is not in the next object (that is, if there are holes in the chain).

Even with adding properties to objects (which is a no-no for ES.next), dynamic super is never particularly elegant. This was the best solution I could come up with and it’s not pretty: https://gist.github.com/1331748

On Nov 15, 2011, at 13:34 , Dmitry Soshnikov wrote:

> Hi,
> <Just on the Rights of a bike-shedding :)>
> R-proto-class is my quick experiment of yet another class lib for ES5: https://gist.github.com/1366953
> Main features are:
> * Simple super calls (with mentioned before, but modified, "delete-restore" parent link); used only for classes.
> * using Object.create for inheritance (the main part of this lib variant) -- at user-level a programmer uses native Object.create
> * Class.new is a wrapper over Class.allocate and Class.initialize. I.e. overriding <UserClass>.allocate you may allocate different objects
> It's just a lib, it's not proposed for standardization (you may even not to comment on this letter, just take a look for a curiosity); it's just shown again, that in both ES3 and ES5 we had and have lib-versions of such sugar, including good class-level super-calls. So again, if to talk about standardization, then the standardized version (whichever it will be) should be at _least_ much better than all these libs. Including syntactically.
> Cheers,
> Dmitry.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

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/20111115/9900155c/attachment-0001.html>

More information about the es-discuss mailing list