Minimalist Classes

Dmitry Soshnikov dmitry.soshnikov at gmail.com
Tue Nov 1 10:36:12 PDT 2011


On 01.11.2011 21:30, Jake Verbaten wrote:
>
>
>     Why isn't the |super| lookup-point |this.getPrototypeOf()|
>
>
> Assume |super| is |this.getPrototypeOf()|
>
> Let F be a "class", let f be an instance of the class.
>
> inside f you have access to a method defined on F.
>
> If you call a method defined on F from f and that method calls super, 
> you would be invoking getPrototypeOf(this) which is just F (since this 
> is f, and the prototype of f is F). So you would then end up calling 
> the same method again and recurse endlessly.
>
> Basically because you apply methods with a value of this then if super 
> were tied to this you would get infinite super recursion if you 
> chained super calls.

Haven't I just showed a solution for this problem in my previous letter?

This issue is well known for years and have (at least) three working and 
elegant solutions -- i.e. w/o hardcoding names of classes.

Dmitry.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111101/54ede94d/attachment-0001.html>


More information about the es-discuss mailing list