Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign uprename "promise" to "future" (or "fncall"?) #858
Comments
andrewrk
added
the
proposal
label
Mar 24, 2018
andrewrk
added this to the 0.4.0 milestone
Mar 24, 2018
andrewrk
changed the title from
rename "promise" to "future"
to
rename "promise" to "future" (or "fncall"?)
Mar 24, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sebastien
Mar 26, 2018
If I might add to the discussion, I would make the following distinction:
-
A coroutine is essentially a new line in the control flow (such as processes, thread and fibers/green threads/lightweight threads/coroutines), meaning it abstracts away a process, not necessarily a value (think of a coroutine that just sleeps for 10s). As a result, it's not the best use of the term to denote values (which promises and future do)
-
A functional call is an operation, which operational semantics can greatly vary. In most runtimes, a functional call means the current control flow is borrowed from the call site. This control flow is also a line in the overall control flow (ie. a process, thread, etc). In using the term
fncallyou would then be referring to an operation that, as a side effect, does something to the control flow, but not necessarily to its result.
So I would say that coroutines (as coro) and function calls (as fncall) would be pertinent as denotations of different types of control flow lines (such as processes and threads) -- hence the cancel/resume/suspend, but do not really denote the same things as promises or futures, which are resulting values that might not have exist/been evaluated yet.
To sum this up, control flow is the means/process that allows for the production of the value, and is more appropriate to denote the sequence of actions than the result.
There's a Wikipedia page about Futures and Promises which I hadn't read before, which contains a lot of references. I'm not sure what the introduction is worth though as the only reference for futures comes from Scala, which is definitely not a historical pioneer for the term.
sebastien
commented
Mar 26, 2018
|
If I might add to the discussion, I would make the following distinction:
So I would say that coroutines (as To sum this up, control flow is the means/process that allows for the production of the value, and is more appropriate to denote the sequence of actions than the result. There's a Wikipedia page about Futures and Promises which I hadn't read before, which contains a lot of references. I'm not sure what the introduction is worth though as the only reference for futures comes from Scala, which is definitely not a historical pioneer for the term. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sophistifunk
Mar 27, 2018
Just my 2c, I think ideally you'd want separate entities for the promise (a future result) and the task (resume and cancel).
Also might be nice to take into account some future design for streams, just so the semantics of a stream-that-only-yields-once looks / behaves much like a promise+task combination
EDIT: All these damned words are so overloaded
sophistifunk
commented
Mar 27, 2018
•
|
Just my 2c, I think ideally you'd want separate entities for the promise (a future result) and the task (resume and cancel). Also might be nice to take into account some future design for streams, just so the semantics of a stream-that-only-yields-once looks / behaves much like a promise+task combination EDIT: All these damned words are so overloaded |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sebastien
Mar 27, 2018
+1 for the streams -- they're similar to futures but can have multiple different values. Iterators are conceptually similar but usually don't have an abstraction that share traits with future, while they probably should.
sebastien
commented
Mar 27, 2018
|
+1 for the streams -- they're similar to futures but can have multiple different values. Iterators are conceptually similar but usually don't have an abstraction that share traits with future, while they probably should. |
andrewrk commentedMar 24, 2018
Somebody suggested this and I think it might make sense.
Right now when you make an
asyncfunction call, you get apromise->T. You can implicitly castpromise->Ttopromise.awaitworks onpromise->Tresumeandcancelworks onpromisesuspendgives you apromise->TIt's kind of weird to "resume a promise" and "cancel a promise". It makes a little more sense to "resume a future" and "cancel a future".
This proposal is to change "promise" to "future". Another contender might be "coro" (short for coroutine). Another idea that I just made up is "fncall". It makes a lot of sense to "resume a fncall", "cancel a fncall", "suspend a fncall", and nobody is going to use
fncallas an identifier.