simon.vergauwen
06/14/2020, 7:29 AMstartCoroutineCancellable which you can use as unsafeRunAsyncCancellable, or startCoroutine from the Kotlin Standard Library.
Which can be used as
suspend { program() }.startCoroutine(Continuation(ctx) { r -> println(r) })
val disposable = suspend { program() }.startCoroutineCancellable(Continuation(ctx) { r -> println(r) })
The API I have prototype looks something like this:
/* By default installed on Computation pool, and `e.printStackTrace()` as as async error handler which is also invoked in extremely rare situations */
val enviroment: Enviroment = Enviroment()
enviroment.unsafeRunAsync(::program) { r -> println(r) }
enviroment.unsafeRunAsyncCancellable(::program) { r -> println(r) }
...
Environment is like a combination of what we have today as Enviroment and UnsafeRun.
All feedback is very welcome 🙂