Minimalist Classes

Dmitry Soshnikov dmitry.soshnikov at
Tue Nov 1 10:40:56 PDT 2011

On 01.11.2011 21:34, Axel Rauschmayer wrote:
> If you have a prototype chain of objects, |this| will always point to 
> the beginning of the chain (which is also where properties are created 
> whenever you set a property via |this|). This is what allows methods 
> in the prototype to access instance properties.
> If there is a method m in any of the objects of the chain and it makes 
> a super-call, you want the search to start in the prototype of m’s 
> object – and not in the prototype of |this| (which is always the 
> second object in the prototype chain).
> Does that make sense?

No it doesn't. Is there someone on the list who reads it carefully?

Once again. This is a well-known for years issue and has _several_ (at 
least three) solutions. One of them (which I call "delete-and-restore 
parent link" technique) I showed in the previous letter.

The mentioned technique allows normally to make super calls w/o 
hardcoding names of classes. Other techniques (such as using caller and 
wrappers) also can be used, but not so efficient.


> On Nov 1, 2011, at 18:22 , John J Barton wrote:
>> On Tue, Nov 1, 2011 at 9:45 AM, Allen Wirfs-Brock 
>> <allen at <mailto:allen at>> wrote:
>>> On Nov 1, 2011, at 6:53 AM, Jeremy Ashkenas wrote:
>>> The complication of super is that each "super call" requires two 
>>> independent
>>> pieces of state in additional to the method arguments: the object 
>>> that will
>>> be used as the |this| value of the resulting method invocation and the
>>> object where property lookup will begin when searching for the  method.
>>> Let's call this the "lookup-point".   |super| when used to access a 
>>> method
>>> property really represents a pair of values (this,lookup-point).  In the
>>> general case, these are not the same value so they must be independently
>>> captured and represented.
>>> Where do these two pieces of state come from?  The |this| value of a 
>>> super
>>> call is simply the |this| that was dynamically passed into the calling
>>> method.  Where does the look-up point come from.  There are 
>>> fundamentally
>>> two possibilities:
>>> a) it is dynamically passed to every method invocation, ;just like 
>>> |this|
>>> currently is
>>> b) it is statically associated with the method in some way.
>> I'm just curious and I think understanding the following point would
>> help developers:
>> Why isn't the |super| lookup-point |this.getPrototypeOf()| (The
>> protolink or [[Prototype]])?  I thought that if
>>   let f = new F();
>> and F inherits from G, then will have this.getPrototypeOf()
>> === G and that is what super would be? Somewhere I went wrong...
>> jjb
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at <mailto:es-discuss at>
> -- 
> Dr. Axel Rauschmayer
> axel at <mailto:axel at>
> home: <>
> twitter: <>
> blog: <>
> _______________________________________________
> es-discuss mailing list
> es-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list