>
> I think I'd rather see `Promise.resolve` changed to use `this.constructor`
> instead of `this.[[PromiseConstructor]]`, like every other Promise-related
> method.  Can someone who feels strongly otherwise give me the use case for
> `[[PromiseConstructor]]` existing?
>

I'll give it a shot.

"Promise.resolve", executed on a constructor C, with argument x, should
only return x if x was created by C.[[Construct]].  Otherwise it should
create an instance of C which is resolved with x.

If we used "x.constructor" to determine the actual constructor, then
someone could just change the "constructor" property for x and fool someone
who wrote "C.resolve(x)" and expected to get an instance of C back.

It would be an unreliable, unsound conversion function.

Proper subclassing requires subclassing support from the engine.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to