Making "super" work outside a literal?

Brendan Eich brendan at mozilla.com
Sun Jun 26 15:44:46 PDT 2011


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.


>   BTW there are other proposals floating around that also have this characteristic, for example perhaps some of the private property proposals. We need to be concerned about those too.

Not the only one that matters:

http://wiki.ecmascript.org/doku.php?id=harmony:private_name_objects

It has only imperative API via a built-in module. So if anything, it's missing declarative syntax.


> It is important to find a good balance between power and bullet-proof footwear.  But, intentionally restricting an imperatively constructed object from using |super| in order to prevent foot shooting seems very un-JS like.

I know, I think I said that too :-P. That is, JS has the bamboo tube, saltpeter, and other raw ingredients like unbound 'this' projectiles for James Tiberius Kirk, captain of JS hacking, to assemble a bazooka the hard way, to conquer the big lizard-alien programming problems. But lesser mortals sometimes have it blow up in their faces, shoot backwards, take off a leg, etc.

Gotta admit, universal 'super' with defineMethod hangs together -- it would be easy to implement.


> More tomorrow, goodnight.

Goodnight!

/be


More information about the es-discuss mailing list