https://kotlinlang.org logo
#coroutines
Title
# coroutines
d

dstarcev

01/30/2018, 1:20 PM
But doesn’t making assumptions about implementation lead to leaky abstractions?
d

diesieben07

01/30/2018, 1:35 PM
Whether or not a method blocks it not part of the implementation but of the interface contract imho.
d

dstarcev

01/30/2018, 1:53 PM
@diesieben07 imagine a typical
Logger
interface. Implementations often utilize I/O but you can hardly meet a non-blocking logger.
d

diesieben07

01/30/2018, 1:54 PM
There is a difference between non-blocking and suspending.
Every suspending method should be non-blocking, but not every non-blocking method suspends. You can have a non-blocking method that instead of suspending returns e.g. a
CompletableFuture
or a
Deferred
.
6 Views