by lidHanteyk · 7y ago · 0 comments
I.e., what is the interface of a promise?
There are two main operations that can be done with a promise. We can wait for it to complete, and then perform another action when it is complete, known as "when-blocks"; we can also send a message on top of another sent message, informally known as "promise pipelining".
When-blocks:
when (action) -> { doMoreStuff() }
Promise pipelining: promise<-add(4)<-subtract(3)
[0] https://groups.google.com/forum/#!topic/cap-talk/y1bEqOoeswEOn the other hand, a Future [Baker and Hewitt 1977] has the following well defined interface:
Future<t> *interface* resolve[] ↦ t