Making "super" work outside a literal?

Brendan Eich brendan at mozilla.com
Sun Jun 26 12:39:40 PDT 2011


On Jun 26, 2011, at 10:49 AM, Oliver Hunt wrote:

> On Jun 26, 2011, at 9:29 AM, Brendan Eich wrote:
> 
>> In the languages and systems that have super()-only, a method always has a name.
>> 
>> So we could define "method that can use super" narrowly, as the new syntax in object initialiser, or in class body.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(Note above underlined bit.)


>> No, not if the compiler sees the method name and burns it into the function object. Then it's just an internal property, analogous to static super. This is what engines do today with named function forms (definitions, named function expressions).
> 
> I don't follow what you're saying here --
> 
> SomePrototype.foo = function() { super() }

See above -- I was suggesting restricting super to certain contexts: methods in classes and object initialisers only. Just a thought.

/be



More information about the es-discuss mailing list