https://kotlinlang.org logo
k

kingsley

09/17/2017, 12:41 PM
I’d imagine the idea was to keep the design flexible. 1.
Job
is lightweight and it’s more like the representation of the state of the coroutine.
Deferred
itself is actually a
Job
, but with more capability. It holds the result of the execution 2. The behavior of
async
and
launch
is slightly different in that
launch
will propagate any exceptions thrown, whereas
async
saves that result/exception in the
Deferred
. This also makes sense given the description in (1) above. This is only my understanding of it. Perhaps someone will put up a more detailed description of the design decisions.
👍 2