>
> 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.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to