Sam Garfinkel
04/03/2020, 4:51 PMSam Garfinkel
04/03/2020, 4:54 PMstart = CoroutineStart.LAZY :
val deferred = scope.async(start = CoroutineStart.LAZY) { "hello" }
val future = deferred.asCompletableFuture()
future.get() // Not sure this will actually cause the deferred to be evaluatedEsau Betancourt
04/03/2020, 5:15 PMCompletableFuture
future{
}.await(()octylFractal
04/03/2020, 6:13 PMasCompletableFuture() doesn't work with LAZY is the same reason that the scope.future call says:
* A value of [CoroutineStart.LAZY] is not supported
* (since `CompletableFuture` framework does not provide the corresponding capability) and
* produces [IllegalArgumentException].octylFractal
04/03/2020, 6:14 PMasCompletableFuture() just failed, since you could still manually start() the deferred in kotlin... but maybe it deserves some documentationSam Garfinkel
04/03/2020, 6:15 PMval foo by lazy { scope.future { something.await() } }Sam Garfinkel
04/03/2020, 6:15 PMSam Garfinkel
04/03/2020, 6:16 PM