Making "super" work outside a literal?

Peter Michaux petermichaux at
Mon Jun 20 17:13:00 PDT 2011

On Mon, Jun 20, 2011 at 3:23 PM, Axel Rauschmayer <axel at> wrote:

> What is the use case for sideways calls? Can you point me to an example?

You want to allow the API (a.k.a. public methods) of an object to be
overridden, but you don't want the functionality of any non-overidden
API methods to change. In short, you want to avoid the template
pattern. I gave a synthetic example in the sideways calls thread I

> 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.

Perhaps useful in combination with __noSuchMethod__. More efficient to
dynamically generate a method on the "here" object once then on all
the "this" inheriting objects one-by-one.


More information about the es-discuss mailing list