New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terminology #5
Comments
It's probably obvious, but I do like separating the states from the verbs, mostly because of the I think the impact of going with these state names, even though they are different from current "state of the art", is relatively minimal from a code perspective. Changing resolver verbs seems much more invasive. If we end up in a situation where the promise states are fulfilled and broken, and the resolver verbs are resolve and reject, do you think that will cause more confusion? |
I think those states are good for the spec but don't need to be reflected exactly in the implementations |
I've now written and deleted three separate responses.
I agree with you semantically, but I don't see a reason to deviate from the status quo here.
I have no qualms about using "unresolved" as meaning "not fulfilled or broken/rejected", but because
Agreed that changing verbs would be more invasive. |
And now after writing that response, I read the linked Q issue thread. I really need to follow links sooner :) I was also thinking about |
It sounds like the question really comes down to "broken" vs. "rejected". My move toward "broken" is motivated by the resolver issue, as I've explained, but I can also see the value in not changing existing terminology. I won't hold fast on either direction. I'd like to hear from @wycats and @kriskowal on this one. |
I'm also not passionate about "rejected" over "broken". I like the semantics of "broken", but don't want to ruffle feathers unnecessarily. I'll go either way. |
Before we synthesize something, here’s some more analysis. @douglascrockford uses a different set of terms in https://github.com/douglascrockford/monad/blob/master/vow.js
"keep" and "break" are the natural conclusive states for a "promise" as far as the English language is concerned. "make" is the right verb for "making a promise", though not as good for making that which "Q.defer()" returns, regardless of what it’s called. |
Also, "resolve" has been called "become". It’s a good word. |
I can’t speak for the original authorial intent of Tyler Close for the ref_send lib.Q API, but a good reason to avoid keep and break was that break was a keyword. If you ditch "keep", you need terminology that doesn’t imply the existence of "keep", ergo "resolve" and "reject". It’s still a good reason for any promise library that needs to be used in a JavaScript engine that doesn’t allow keywords for property names. That said, a forward-looking library would use a lot of keywords. |
Maybe I've just been staring at JavaScript-related promises for so long, but to me "you should fulfill your promise" seems just as natural (if perhaps a bit more formal) as "you should keep your promise". Hrm. |
Also, I really like "become" as a resolver [sic] verb. |
I like the make/keep/break triad a lot. It's short, natural, obvious, all one syllable. It's a shame it has the I like "become" because it's also simple and obvious. Only two concerns: 1) people may take it to mean than just adopting promise state+value/reason, and 2) it sounds less "final" than "resolve", so folks might think you can do it more than once. Documentation can probably solve both. "fulfill" is just as natural for me as "keep", and "filfill a promise" is listed as a synonym for "keep a promise" in a few places. Another one I just ran across: "honour", "honor" I still prefer "broken" over "rejected", but "break" is a problem, and I understand the "broken implies the existence of kept" argument. So, the question there is whether the states need to match the resolver verbs, or can/should they be independent. I honestly don't know what's best there. At least right now, after a couple beers, I could live with: promise states: resolver verbs: promise creation (map nicely to promise states): ... not sure about a good word for creating one promise from another, i.e. the creational analog of become? "like(promise)", "from(promise)"?? |
FYI Futures in Scala: http://docs.scala-lang.org/overviews/core/futures.html |
Cool, thanks for the pointer @juandopazo. The "successful" and "failed" terms work well for describing a task, but not necessarily for describing a promise, imho. Makes sense in the Scala case since it all sounds more task-oriented. Interesting info around the The term "future" is kind of nice, although I'm not sure how we'd incorporate it ... maybe it's an alternative to the creational "pending()"? There's also Twisted Deferred. From what I understand, Dojo's original Deferred impl was nearly a direct port of Twisted's. I'm not really crazy about the terminology, tho. |
The way I see it, the globally optimal vocabulary is "promise", "keep", "break", "notify", and "transfer". However, "break" is the fly in the ointment. The locally optimal vocabulary includes "promise", "fulfill", and "reject". I don’t think we’ve yet seen a good option for "defer" or "make", or a good name for a promise and resolver pair. "defer" isn’t great, but is’t horrible. "make" collides with another primitive in Q that is used to make promises for any of the states, including proxies for remote objects. We haven’t seen a good option for "resolve" either. It might be okay to have "fulfill", "reject", "transfer", and "coerce", to separate the last two responsibilities of modern "resolve". Thus, when a callback returns a value that might be a promise to keep working, the mechanism could look liked |
One possible insight is that the "defer()" method is not necessarily called by the entity "making the promise" (in the English sense). It could be thought of as an arbiter or witness, who creates the "entangled pair" of "promise" and "keeper/breaker/notifier-of-progress". The person "making the promise" (in the English sense) gets the "resolver" and the person who has been given a promise — gets the promise. The "resolver" represents "responsibility". Naming is hard. |
@kriskowal lots of great stuff in your last two posts! I like the idea of "transfer"/"coerce" to separate the behaviors. "Transfer the responsibility of fulfilling or rejecting" seems like a nice way to think about it. I also like the "arbiter" way of thinking about the {promise, resolver} pair. That's how I tend to think about it, but hadn't thought of the word "arbiter"--it's is a good one. When/if we get into creating a Resolvers/A+, I think it'll be great to separate the resolver as a passable object, and to explore the transfer/coerce idea more. To bring this conversation back to Promises/A+: if we were to agree that the verbs "fulfill" and "reject" seem like a good way forward for Resolvers/A+, then it makes sense to me to go with "fulfilled" and "rejected" as the state names for Promises/A+. That only leaves the "pending" vs. "unresolved" decision. If we ditch "resolve" in favor of "transfer"+"coerce", then "pending" seems like the right choice. How does everyone feel about going with "pending", "fulfilled", and "rejected" for state names in Promises/A+? |
I'm +1 on either pending/fulfilled/rejected or pending/fulfilled/broken. (Aside: I think naming the callbacks |
Hmmm, good point. I like |
+1 on {pending, fulfilled, rejected} per my prior comment. |
…ed/onRejected as callback names to avoid confusion with fufilled/rejected state names
b002072 incorporates the latest terminology suggestions. Please have a read through, and let me know what you think, and if I missed anything. |
{pending, fulfilled, rejected} looks very good. You missed the change to |
@juandopazo indeed! search and replace fail. I knew you guys would find my mistakes :) Thanks |
A search within the document for "br" leaves the following snippet:
Otherwise I think you got them all! |
Thanks @domenic |
I think this is closeable now; all future terminology discussions belong in the realm of Resolvers/A+. (Whose very name will depend on such discussions, heh.) |
Onward to #7 |
domenic commentedOct 25, 2012
Getting the terminology standardized would be really nice. Currently, the state of the art among Promises/A-compliant implementers is:
Furthermore, these implementers generally also include the following resolver-related verbs:
resolve(otherPromise)
: a verb, wherein the resolver tells its promise to take on the (possibly eventual) state ofotherPromise
.reject(reason)
: a verb, wherein the resolver tells its promise to become rejected withreason
.As is, Promises/A+ switches from rejected to broken, and settles on "pending" while leaving any mention of "unresolved" or "resolved" out.
I kind of like this, as it allows us to separate the promise states {fulfilled, broken, pending} from the resolver verbs {resolve, reject}.
Compare this to the current status quo: the promise states are {fulfilled, rejected, unresolved} whereas the resolver verbs are {resolve, reject}. There is a great symmetry between reject and rejected, but that is deceptive, because resolve and resolved are almost entirely unrelated. (That is, you can resolve with an unresolved promise, which leaves the resolver's promise as "unresolved".) See also kriskowal/q#122 and the discussion contained therein.
Alternately, we could try to just standardize on the existing terminology, since there may not be much gain in changing. In that case we could leave attempting to fix the resolver/promise terminology mismatch to an eventual Resolvers/A+ spec.
The text was updated successfully, but these errors were encountered: