Making "super" work outside a literal?

Axel Rauschmayer axel at
Mon Jun 20 15:23:52 PDT 2011

> It doesn't seem quite right that an upward call like
>    Object.getPrototypeOf(here)
> has sugar
> but sideways calls like
> don't have any sugar.

What is the use case for sideways calls? Can you point me to an example? If you are after data that is private to a given prototype, consider using an IIFE, instead.

There are various interesting ideas in other programming languages when it comes to combining methods while overriding:
- Cooperative methods: force overriding methods to call them.
- Before/after/around methods: are invoked before/after/before+after a method that they override:

But that would be overkill for

> By the way, I like this idea that "super" is available all the time
> (not just in an initializer) like "this" is always available; however,
> adding another implicit variable "here" which is dynamic like "this"
> is disconcerting as "this" has been quite a wild beast in JavaScript
> to say the least.

I framed things in terms of |here|, because that value can be easily produced, as a byproduct of looking for a property. It might also, some day, give us the ability to *set* a property that is not at the beginning of a property chain. For now, programmers would never directly see |here|, only |super|. |super| would be computed on demand, only when someone asks for that value.

Dr. Axel Rauschmayer

axel at


More information about the es-discuss mailing list