News for hackers. Stuff that matters.
Re:Java 21: First Release Candidate by yafetn on Monday August 14, 2023 @06:43PM (#37127686)
Can someone please explain how Project Loom and virtual threads in the JVM affect Kotlin’s coroutines?
Re:Java 21: First Release Candidate by adra on Monday August 14, 2023 @07:41PM (#37128259)
If you think about how you use os threads today, you have two main dispatcher pools, default (cpu), and IO (for IO processing). You can now swap out the discrete IO threads with a virtual thread pool instead. You can get the "infinite" IO (blocking) task benefits of virtual threads like normal java virtual thread pools while still using the same benefits of structured concurrency that coroutines grants.

In reality, this will take a bunch of time to actually show much real results. We've been producing async future driven libraries for a long time, and they're generally pretty good at keeping the computer busy while sending out many concurrent IO requests. The real benefits are when these libraries start to support these virtual threads which should ideally lead to less complexity and some lesser compute overhead (my hopes).

Re:Java 21: First Release Candidate by dangets on Monday August 14, 2023 @07:07PM (#37127973)
Here's a take from Roman Elizarov (Kotlin bias) - https://www.youtube.com/watch?v=zluKcazgkV4

I imagine a lot of the missing structured concurrency will get built up over time on the Java side, but it is an interesting talk regardless.

Re:Java 21: First Release Candidate by yafetn on Monday August 14, 2023 @07:30PM (#37128179)
Yeah, I watched that talk (and many others from KotlinConf) but it was a bit too high level and not actionable.
Re:Java 21: First Release Candidate by papercrane on Monday August 14, 2023 @06:59PM (#37127874)
It largely doesn't affect Kotlin's coroutines. Kotlin targets platforms where Loom is not available (e.g. Android, native.)

As a developer if you're targeting the JVM with virtual threads you may decide to use those for some workloads instead of coroutines.

In the future when targeting the JVM Kotlin maybe can use the features exposed by Project Loom to execute coroutines more efficiently, but it's not clear to me that there's much for Kotlin to gain there, maybe some small gains in performance.

Re:Java 21: First Release Candidate by pjmlp on Tuesday August 15, 2023 @02:22AM (#37130826)
They are married to Android, naturally everything that doesn't exist on Android will hardly make it into Kotlin.

And since they also want to compete with Swift and TypeScript, on their own turf, even less likely.

This is the thing with guest languages, cannot embrace the platform, always full of compromises.