Promises should use the term "fulfilled" instead of "resolved"
|Reported by:||Owned by:|
I had a discussion with Promises/A spec co-creator Kris Kowal recently, who blames himself for misusing the words "resolved" and "rejected" in a way that later came to be adopted by jQuery.
Currently, jQuery Promises transition from their initial *pending* state into either a *resolved* state (when the Deferred's
resolve() method is called) or a *rejected* state (when the Deferred's
rejected() method is called). There's no good term for a Promise that's been either resolved or rejected ("non-pending"?).
In the Promises/A spec and its implementations, what jQuery calls the *resolved* state is instead called *fulfilled*, and a Promise is said to be "resolved" when it's either fulfilled or rejected.
I would suggest that jQuery move in this direction by deprecating the
resolve() method in favor of an alias named
fulfill(), just as
complete() was renamed to
always(). Since this wouldn't affect backward-compatibility, it could be done immediately. In 1.8, the string returned by the
state() method could be changed from
"fulfilled", and the documentation could be updated to use the new terminology.
This would, in my view, greatly reduce confusion in the long term. I don't really care about jQuery deviating from the Promises/A spec (notably with
then(); see #11010), but I do care about good terminology. To my mind, it makes a lot of sense to have two dichotomies: fulfilled vs. rejected, and pending vs. resolved.