r-proto-class

Axel Rauschmayer axel at rauschma.de
Tue Nov 15 06:34:27 PST 2011


>> 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
> 
> Is it based on the technique I showed before? Nice :) Though, where is the reference on the author, you cheat? :D

It’s very loosely based on Ashkenas’ approach, but there is a crucial difference: I don’t advance just one object for each recursive call, I traverse the prototype chain (for however long it takes) to find the next method and record it as `here` (the object containing the method making a super-reference). Hence, my solution can handle “holes” in the prototype chain, Ashkenas’ solution can’t.

But I would not want to use that solution, a static approach is much more elegant.

-- 
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/1958bdc0/attachment-0001.html>


More information about the es-discuss mailing list