Making "super" work outside a literal?

Axel Rauschmayer axel at
Mon Jun 20 16:07:05 PDT 2011

Right. Sorry if I added to the confusion. My explanation was along the lines: “If there is a dynamic |super|, then...”. The lexical |super| is perfectly adequate.

I’d imagine it would work something like this (modulo some syntactic sugar):

var Super = {}; = function() {
    return "Super: ";

var Sub = Object.create(Super); = function me() {
    return "Sub ";
// The following assignment would normally be made by an inheritance API = Object.getPrototypeOf(Sub);

var s = Object.create(Sub); = "fcb3";
console.log(; // Sub Super: fcb3

On Jun 21, 2011, at 0:43 , Brendan Eich wrote:

> On Jun 20, 2011, at 2:51 PM, Peter Michaux wrote:
>> 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.
> 'super' is not dynamic as proposed in Even in Allen's recent post about Object.defineMethod, 'super' is not bound dynamically per call site, as 'this' is. It's a hidden property of the function object.
> /be

Dr. Axel Rauschmayer

axel at


More information about the es-discuss mailing list