Project Loom will bring continuations and fibers (similar to kotlin coroutines) natively to the JVM in a not so distant future.
It seems like they will be able to achieve to automatically convert blocking calls to suspending ones, when run inside a fiber. This magically makes things like
Thread.sleep() or socket io suspending. There is no need to mark functions with a
suspend modifier, annotation or similar.
Also they have plans to provide some form of structured concurrency.
For me the opportunity to automatically turn all the existing, blocking calls into suspending ones is very exciting. For example JDBC would magically become non-blocking
Will kotlin coroutines be able to leverage this new feature? Will a
Thread.sleep() on the JVM after project Loom be suspending instead of blocking? Would coroutines on the JVM need to be re-implemented on top of Fibers for that to work? Is that a feasible option?
I think having kotlin coroutines and Fibers integrated very well will be crucial for interoperability. What’s your opinions on this?