3 ms·
Maybe with kotlin coroutines you can rewrite the application partially. Is there a difference between that and fibers?
by digaozao 7y ago
Maybe with kotlin coroutines you can rewrite the application partially.
Is there a difference between that and fibers?
- avodonosov 7y agoKotlin coroutines, as well as js and c# async/await, require us to change declaration of calling function. We can call a "suspend" function only from a "suspend" function, which in turn can only be called by another "suspend" function. So if I change some of my functions to "suspend" everyone upper in the call stack should be changed to "suspend", which is not always possible because that may be a 3rd party code. That's not necesserily a deal breaker, but that's the difference. For Java there is Quasar lib, which introduces async/await through bytecode instrumentation. It's by the same authors who work on the project Loom currently. I don't use it because: a) the project web site feels a bit abandoned; I guess they concentrate on Loom now 2) I need analogues of wait/notify, sychronized, etc which are used in this code and not provided by Quasar; Quasar only provides lower-level primitives. One either need to implement such constructs on top of Quasar, or reimplement the logic. So it's not a drop-in replacement. The project Loom aims to be mostly a drop-in, in particular fibers will support synchronized, wait/notify, etc.
- deleted 7y ago[deleted]
- jarym 7y agoQuasar was created by the same guy (Ron Pressler) that is the tech lead for Project Loom. The reason Quasar feels a bit abandoned is because he's bringing the thinking right into the JVM.