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.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to