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 = {}; Super.foo = function() { return "Super: "+this.id; }; var Sub = Object.create(Super); Sub.foo = function me() { return "Sub "+me.super.foo.call(this); }; // The following assignment would normally be made by an inheritance API Sub.foo.super = Object.getPrototypeOf(Sub); var s = Object.create(Sub); s.id = "fcb3"; console.log(s.foo()); // 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 > http://wiki.ecmascript.org/doku.php?id=harmony:object_initialiser_super. 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 a...@rauschma.de twitter.com/rauschma home: rauschma.de blog: 2ality.com _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss