Making "super" work outside a literal?

Brendan Eich brendan at mozilla.com
Sun Jun 26 12:48:45 PDT 2011


On Jun 26, 2011, at 10:54 AM, Axel Rauschmayer wrote:

> This would only work inside an object literal

or in a method in a class.


> (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.


Allowing 'super' in any function, requiring Object.defineMethod to be used with an object and a name for that function to be callable and survive its first super reference, is plausible and as you note, there's a name to burn into the function if necessary.

But I still wonder if we wouldn't be better off restricting where super can occur. I can't prove it, but we are following in the universal-'this' footsteps (but with static or else Object.defineMethod binding). That sounds a warning bell in my head.

/be


More information about the es-discuss mailing list