> Le 12 mai 2015 à 04:51, Glen Huang <[email protected]> a écrit :
> 
> However, forcing super has one major drawback: it becomes cumbersome when you 
> don't want to call superclass's constructor(), that you want to define a new 
> constructor() to override it.
> 
> When that happens, you have two choices:
> 
> 1. don't use "this", create a new object and return it.
> 2. use the old way to create "class"

To be short, for me, there are two more choices:

3. maybe subclassing that particular class is not the correct abstraction here;
4. correct the design of the super-constructor, so that it is able to just do 
the minimum required stuff.

Also, as an alternative to your choice #2, there is the following possibility 
that I don't propose very seriously, although I wonder if it might be more 
semantically correct than subclassing in your use case. Instead of `class B 
extends A { }`, write:

```
class B { }
Object.setPrototypeOf(B, A)
Object.setPrototypeOf(B.prototype, A.prototype)
```

—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to