Suspend keyword is part of Kotlin StdLib,
but Is there any use cases besides coroutines ?
A) Yes. Can you provide some explanation, doc or example about it.
I dig it and all I can find is some kotlin.coroutines.* Continuation/CoroutineContext/startCoroutinemetc.) stuff all related to Coroutines.
I’m out of idea and I want to understand
B) No. Then shouldn’t we move Suspend.K to the Kotlinx.coroutines library ? And also all kotlin.coroutines* ?
Hi there,
My guess is that Jetbrains wanted coroutines to be decoupled from executors implementations, like Rust did for its futures where you have a variety of implementations (tokio, async-st). Moreover it allow library developers to expose suspending APIs without relying on a specific version of kotlinx.coroutines, which is nice.
In addition playing with barebone coroutines helps you understand how it truly works and sometimes, for very basic stuff, you could use coroutines without kotlinx.coroutine (tho I wont try to do it outside of personal projects)