If it's helpful, you can look at how newless handles this: 
https://github.com/mr0grog/newless/

It's a little more complicated than the earlier replies because many 
implementations have classes but not `Reflect.construct`, but it goes 
gracefully allow ES5- function-style constructors to inherit from class-style 
constructors.

At the end of the day, the one restriction you can't really work around is not 
being able to touch `this` inside the constructor before calling the super 
class’s constructor (unless you don't call it at all, though that will no 
longer work if/when you transition to proper classes).

-Rob


On May 13, 2016, at 6:35 PM, Renki Ivanko <[email protected]> wrote:

>> That said, can't the right thing be done using Reflect.construct?
> 
> It can:
> 
> ```js
> function B() {
>       return Reflect.construct(A, arguments)
> }
> ```
> 
> `instanceof B` will be `false`, though.
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to