Allen Wirfs-Brock (2013-12-28T19:11:23.000Z)
domenic at domenicdenicola.com (2014-01-08T19:52:32.529Z)
On Dec 28, 2013, at 7:38 AM, John Barton wrote: > I think the differences should include to making calls to super() illegal when 'extends' is absent: > > ```js > class C { constructor(url) {super(url);}} // legal, I expected illegal. > ``` Plausible, but what about the possibility that a framework dynamically patches the prototype chain of C.prototype before it is first instantiated or if C uses its @@create method to return instances that have different or extra objects (that have a 'constructor' property) patched into their prototype chain. This, like the base question of this thread, seems like another example of a tension between supporting the "normal" usage patterns for class declarations and allowing enough flexibility to enable using class declarations as building blocks for less normal abstractions. I could probably go either way. Pragmatically, from a spec. writing perspective, the conditions for issuing this error are bit complicated to define. Even without an extends clause the instances still inherit from Object.prototype so super call still need to be allowed in non-constructor instances methods and even in constructor methods things like super.toString() need to be allowed. I generally try to avoid early errors that have a lot of conditions associated with them.