Minimalist Classes

John J Barton johnjbarton at johnjbarton.com
Tue Nov 1 10:22:54 PDT 2011


On Tue, Nov 1, 2011 at 9:45 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> 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 f.foo() will have this.getPrototypeOf()
=== G and that is what super would be? Somewhere I went wrong...

jjb


More information about the es-discuss mailing list