Making "super" work outside a literal?

Axel Rauschmayer axel at
Sun Jun 26 10:54:48 PDT 2011

>>> Using an implicit property name in a super call would require that every method call implicitly pass the name used to access the property.  This is just like the |here| problem.
>> 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 --
> = function() { super() }
> Where is the function name hardcoded?  Certainly JSC makes no distinction in behaviour of function expressions in any context.  The only time a function object created by a function expression will have a name, is when the optional name is provided.  That then raises what super() is in the case of
> = function bar() { super() }
> When this thread initially started my thought was "yes that sounds great!" but i very rapidly came to the conclusion that non-lexical super just isn't workable without introducing inefficiencies in all call sites regardless of whether the dynamic-super feature is used.

This would only work inside an object literal (similar to |super|, where you need to know about |here|, the owning object).
Additionally, Allen’s Object.defineMethod already has a parameter with the method name, so it would work there, too.

Dr. Axel Rauschmayer

axel at


More information about the es-discuss mailing list