Maybe `async` should return `Coroutine` class
# coroutines
r
Maybe
async
should return
Coroutine
class
e
rrader: This is the wrong concept. Coroutine is just a background computation. Coroutine ~ Thread. While
async
returns an object also known (in computer science) as a future or a promise: https://en.wikipedia.org/wiki/Futures_and_promises
We could have named
Coroutine
the result of
launch
function, but we don’t need any extra functions on it beyond those that are already provided by a
Job
.
r
but
Deferred
also seems incorrect, because it means it will run later
I think it should meen that is a subroutine that runs at same time, maybe
AsyncSubroutine
h
Coroutine has different meaning already, it wont be good to use it two times
e
Deferred here is just a synonym for Promise/Future and it does mean that it is run later. That is actually what is happening — it is being run later
You can also say that it is run asynchronously, but nobody is calling the resulting value async-anything.
Look at the
async
result in other languages: C# calls it
Task
, JS calls it
Promise
, Dart calls it
Future
.
In CS, there is no accepted synonym for future/promise that uses “async” root
r
ok, it will run almost at the same time in Go also are
defer
https://tour.golang.org/flowcontrol/12
it meen it will run at the end of a function
e
Go’s
defer
is a misnomer. We cannot help that.