Is it a bad idea for me to implement my own `Conti...
# coroutines
y
Is it a bad idea for me to implement my own
ContinuationInterceptor
? By that I mean, could it mess up other things that kotlinx-coroutines does? I plan to delegate most of it to whatever the current interceptor is, but while adding a trampoline to implement something similar to
DeepRecursiveFunction
but allowing foreign suspension (and so, upon an intercepted resumption, I need to spin up the trampoline again).
Before you ask, yes I'm aware that
yield
may help, or
startCoroutine
, but I don't want either of those. For
yield
, it doesn't trampoline if it's the only coroutine on the
Unconfined
dispatcher. For
startCoroutine
, it requires a Dispatcher to already be there, but that's not guaranteed in my case (
suspend fun main
strikes again), and it's a bit more expensive (it has to maintain a queue and such, while I want to just trampoline, and so I only need to keep track of the call to make and the continuation, exactly like
DeepRecursiveFunction