Fixing `Promise.resolve()`

Domenic Denicola d at
Wed Jun 10 15:39:55 UTC 2015

From: Allen Wirfs-Brock [mailto:allen at] 

> I don't think we discussed the possibility of Promise subclasses with different promise signatures at the May meeting; we mainly focused on the expectation that SubPromise.resolve(x) should yield an instance of SubPromise.

Yeah, and to be clear, I generally agree with this. My LabeledPromise example adheres to this. Other examples in related threads have been setting @@species to an entirely new constructor (e.g. to Promise itself), which is very strange to me. If you do that, you deserve whatever weirdness you might get, IMO. From the beginning, @@species has been about constructor signature modification.

> But I see your logic, indirecting through species provides a way for subclasses to to change their constructor signature and still work correctly with the other inherited Promise static methods. 

Any thoughts on Array.of and Array.from?

More information about the es-discuss mailing list