Making "super" work outside a literal?

Axel Rauschmayer axel at
Tue Jun 21 07:40:52 PDT 2011

>> We wish to avoid another parameter computed potentially differently for each
>> call. It will cost
> What costs do you foresee?  I am not sure that there is much to
> compute.  Assume a method call O.m().  Assume "m" is found on an
> object P within O's protoype chain.  This will result in P.m being
> called, for which the "super binding" can simply be computed as
> P.[[Prototype]].  Next assume a direct function call, e.g.
> or f() (this === undefined), the "super binding" here
> could just be calculated as this.[[Prototype]] or undefined if |this|
> is not an object.

This may already be what you are suggesting, so to clarify:

I would introduce a binding called "here" that points to the object P where m has been found.

- Method that uses super: compute super as here.[[Prototype]]
- Non-method function that uses super: "here" is undefined, using super causes an error.

If super is not used there is little computational cost! (Other than a binding per function call which may still be prohibitive.)

Dr. Axel Rauschmayer

axel at


More information about the es-discuss mailing list