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

Dominaezzz

07/16/2019, 9:02 AM
Is it okay for java code to pass an instance of
Continuation
to a kotlin suspend function? Isn't it pretty much the same as using callbacks?
g

gildor

07/16/2019, 11:19 AM
Yes, it's pretty similar
d

Dominaezzz

07/16/2019, 11:24 AM
So I can expose suspend functions in my library and not have to worry about java users not being able to call them.
g

gildor

07/16/2019, 1:51 PM
It's not the best kind of callback API (what should Java user to context for example). Much better to expose it for Java users as some proper Java asyncronous abstraction: completable future or RxJava single
Also it would be properly cancellable