Minimalist Classes

Brendan Eich brendan at
Wed Nov 2 11:21:03 PDT 2011

On Nov 2, 2011, at 10:52 AM, Quildreen Motta wrote:

> On 02/11/11 15:42, Erik Corry wrote:
>> 2011/11/2 Quildreen Motta<quildreen at>:
>>>> I don't think hard coding the name of the super-constructor is a
>>>> problem.
>>> It is when you take into account that functions in JavaScript are not bound
>>> to an object, they are generic. You can simply assign any function to any
>>> object and it'll most likely just work.
>> I think the chances are slim that you can take a function that does a
>> super call, put it on a different object, and it will 'just work'.
>> It's a pretty rare case.
> "most likely". Also, it should work if |super| were dynamically resolved, as long as the object implemented what's required by the call.

We can't do dynamic super without adding a parameter to every function call everywhere (modulo optimization), or simulating Algolish nested scopes using dynamic scope hacks, or worse. This is something we won't do, I'm pretty sure Erik agrees.

The super proposal in Harmony is static, but you can Object.defineMethod to transplant (a method clone with different [[Super]], of course -- again modulo optimizations). [[Super]] is an internal property of function objects. I believe Allen is correct that this is how dynamic OO languages in general support 'super'.


More information about the es-discuss mailing list