On 11/4/15 10:29 PM, C. Scott Ananian wrote:
Again, the reasoning at the time was that `Promise.all(x)` could be
considered sugar for `Promise.resolve(x).all()` in ES7, and so
`Promise.all` was "really" an instance method after all.
OK, but note that the behavior of the two is different (or at least the
behavior of @@species is different between Promise.prototype.then and
Promise.all). Specifically if I have:
class MyPromise extends Promise {
static get [Symbol.species]() { return undefined; }
}
then MyPromise.all() will return a MyPromise but
MyPromise.resolve(x).then() will return a Promise, because
SpeciesConstructor falls back to "defaultConstructor", not "C", if
Get(@@species) returns null-or-undefined, while Promise.all()/race()
fall back to "C".
I'm just saying it wasn't totally crazy, and no one
made any objection at the time.
Sure. Also, no one has implemented any of this stuff yet. ;) I was
just implementing it and was confused by the various inconsistencies. I
can implement it as written, of course, but I wanted to double-check
that I wasn't misunderstanding something.
-Boris
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss