diesieben07
08/06/2018, 10:00 PMval a: Deferred<Boolean> = TODO()
val b: Deferred<Boolean> = TODO()
val result = async {
a.await() || b.await()
}
Alowaniak
08/06/2018, 10:07 PMdiesieben07
08/06/2018, 10:12 PMjw
08/06/2018, 10:40 PMselect
groostav
08/07/2018, 1:46 AMDeferreds
are eager by default, in other words, when you write async
, we dont create a lazy coroutine by default. In other words, by expressing right
as a Deferred, its already running, so you've already lost the point of short-circuiting typically. If you chose to express it as a suspend () -> Boolean
though...bdawg.io
08/07/2018, 5:41 PMval a: Boolean
val b: Boolean
a || b
, a
is evaluated first and THEN b
, which the results happen to be available already so it can immediately evaluate. It seems inconsistent that a Deferred
variant would potentially evaluate b
first instead of awaiting the value of a