Making "super" work outside a literal?

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Jun 25 10:31:04 PDT 2011


On Jun 25, 2011, at 6:10 PM, Brendan Eich wrote:

> On Jun 24, 2011, at 1:00 PM, Allen Wirfs-Brock wrote:
> 
>> If there was a mechanism for lexically addressing this, I would expect |super| to track |this| in parallel.  From a value perspective, |super| is just a synonym for |this|.
> 
> This is an important point, although what is a non-value perspective in JS?

Perhaps I should have said binding perspective.


> There are no explicit types. The answer must be an implicit type, the superclass view provided by the [[Prototype]] of the class prototype or ad-hoc containing object in which the method using 'super' was written.

What you are concerned about here may be too subtle for some readers.  Any caching of a |super| based property lookup needs to be keyed by the internal type of the object where the property lookup actually starts rather than the internal type of |this|.

> 
> Just a +1 here, and a request to make the proposal language support this as clearly (and up-front in the page) as possible.

Yes, I'll have an expanded proposal soon.

Allen




More information about the es-discuss mailing list