PerformPromiseAll

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Jun 9 15:04:53 UTC 2015


On Jun 9, 2015, at 7:30 AM, C. Scott Ananian wrote:

> `Promise.resolve` doesn't use the species pattern any more: https://esdiscuss.org/topic/fixing-promise-resolve
> The rationale was that `resolve` is more like a constructor than a mutator.
> 
> I don't have a strong opinion about `Promise.all`, but I think perhaps it would be better if none of the static methods of `Promise` (Promise.all, Promise.race, Promise.reject) used the species pattern, which is more appropriate for instance methods (like `Promise.prototype.then`, where it is a natural fit).

I generally agree.  You invoke one of these methods on a specific Promise constructor, presumably with the intend that it is an instance to that constructor you expect to get back.

For example, compare the likely intent of:
   WeakPromise.all(iterator)
and
   Promise.all(iterator)

It seems just like what we discussed for Promise.resolve

Allen


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150609/599cad62/attachment.html>


More information about the es-discuss mailing list