Closed ryan-rowland closed 8 years ago
However, in 2.3.3.3 we specify that the two callbacks supplied should be resolvePromise and rejectPromise. To my understanding, resolvePromise is actually deterministically fulfilling the Promise.
in 2.3.3.3 resolvePromise
does resolving the promise rather than fulfilling I.E. if the argument is a thenable/promise its value will become the fulfilled value (or rejection the rejection reason) rather than the promise. Fulfill takes whatever value as it is, without considering if it's a promise or thenable.
I think the reason it’s called resolve
its that you can pass a rejected Promise
to resolve()
, i.e. it does in fact not necessarily make the Promise fulfilled:
new Promise((resolve, reject) => {
resolve(Promise.reject('ABC'));
})
// => rejected Promise with reason 'ABC'
Thank you for the clarification, guys. This makes perfect sense. I wasn't thinking about resolving with a rejected Promise.
In 2.3, we seem to be defining resolution as the state transitioning out of
pending
, intofulfilled
orrejected
. However, in 2.3.3.3 we specify that the two callbacks supplied should beresolvePromise
andrejectPromise
. To my understanding,resolvePromise
is actually deterministically fulfilling the Promise. Should these more accurately be namedfulfillPromise
andrejectPromise
to closer match our definitions of fulfillment vs resolution?This may appear to be a minor issue, but this recommendation seems to have guided MDN's documentation to suggest the following Promise callback names:
Furthering my concern, I've recently had conversations with other Node.js & JavaScript developers that have suggested the community has moved away from the
fulfilled
terminology and onto theresolved
terminology, which I can only attribute to MDN's misleading documentation.I'd like to tighten up this terminology in this specification, creating a clear distinction between these terms, and ideally propagate said clarifications to MDN and any other documentation confusing these terms. What do you think, contributors?