extending an ES6 class using ES5 syntax?

Boris Zbarsky bzbarsky at mit.edu
Sat May 14 01:30:49 UTC 2016

On 5/13/16 9:04 PM, Domenic Denicola wrote:
>    Object.setPrototypeOf(obj, new.target.prototype); // or B.prototype, but if you derive from B you'll have to do this dance again

This is highly undesirable because it will deoptimize in implementations 
in practice.

That said, can't the right thing be done using Reflect.construct?

> Object.setPrototypeOf(B.prototype, A.prototype);

I believe this will, again, deoptimize in practice...


More information about the es-discuss mailing list