Making "super" work outside a literal?

Allen Wirfs-Brock allen at
Mon Jun 27 08:21:41 PDT 2011

On Jun 26, 2011, at 11:44 PM, Brendan Eich wrote:

> On Jun 26, 2011, at 3:05 PM, Allen Wirfs-Brock wrote:
>> On Jun 26, 2011, at 8:48 PM, Brendan Eich wrote:
>>> 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.
>> While I highly support improving ECMAScript's declarative mechanisms for defining object abstractions I'd be pretty concerned if we had object abstraction forms that can only be created declaratively.  The ability to use reflection to construct such abstractions has already proven its worth both in JS and in other languages.  Having forms of methods that can't be created via reflection seems a step backwards.
> I agree, but I'm not talking about such a declarative-only, no-imperative restriction as such. Rather, an essentially grammatical restriction on where 'super' can be used. But I'm not selling it, just discussing it, so don't worry.

I particular don't want to discover that we have forced programmer into doing things like:

let obj = eval(sup<|{
   method1 () {super.method1()}

to imperatively construct an object that has methods that reference super.


More information about the es-discuss mailing list