<@U12HXPV3L> The proper and idiomatic way is to ne...
# coroutines
e
@minivac The proper and idiomatic way is to never use
Deferred
as your return type. Write a suspending function instead:
Copy code
suspend fun doSomething(param: Int): Something {
   code ...
}
See how much more concise it is!
n
What about in a situation where the result is usually not needed? That means every call has to be wrapped in some type of
launch
or other coroutine control. By returning
Deferred
you make that optional, allowing callers to call and forget about the result.
j
Allowing callers to not handle the result/exception (or make it easier for them to forget) is a bad thing IMO. Not checking the status of a Deferred could actually be something that could be forbidden/warned against when compiling.
n
Ah, that's true, error propagation is a big concern. I suppose that's the best argument against it.