Subclassing ES6 objects with ES5 syntax.
zenparsing at gmail.com
Tue Apr 28 03:01:25 UTC 2015
> x = Reflect.construct(Promise, x, C);
> is another fine way to fool someone who wrote "C.resolve(x)" and expected
> to get an instance of C back.
Thanks for pointing this out. I believe the ability to use an arbitrary
newTarget parameter for Reflect.construct is breaking the intent of
Promise.resolve. Using an arbitrary "newTarget" is also problematic for
the private fields proposal.
It seems to me that Reflect.construct has been given a capability that is
not otherwise expressible with ES6 syntax, and that gap is problematic.
Maybe I've missed some context though. Mark, Allen, any thoughts?
Looking over the Reflect namespace, I also see that Reflect.get and
Reflect.set have been given powers not expressible with syntax: the
receiver does not have to be a prototype parent of the target.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss