News for hackers. Stuff that matters.
Re:JEP proposed to target JDK 19: 425: Virtual Threads (Prev... by nu11ptr on Monday May 02, 2022 @01:38PM (#31238248)
To be fair, the comment above is about how easy it is for the _user_. Having read docs on go's scheduler design I don't think many would argue it is easy to write such a runtime for the core devs.
Re:JEP proposed to target JDK 19: 425: Virtual Threads (Prev... by merb on Monday May 02, 2022 @01:43PM (#31238312)
I added a snippt which also explains the user side, I doubt either has a benefit. both can be misued. I already seen bad go code because of this and I've also seen bad C# code. In fact go code is harder to reason because of this, since you do not know exactly when a function spawns a new goroutine.
Re:JEP proposed to target JDK 19: 425: Virtual Threads (Prev... by nu11ptr on Monday May 02, 2022 @02:00PM (#31238526)
I don't think it is a huge difference, but I still prefer the straight threading model. It uses less keywords, looks like regular blocking code, and most importantly, there is exactly "one" world - not a sync vs. async world that have to coexist. I'm speaking generically, not specific to Java (which I have not written in many years).

> In fact go code is harder to reason because of this, since you do not know exactly when a function spawns a new goroutine.

This is no different in the async/await world, as you never know what function will launch a new "task" (this concept exists in Rust/Python and I assume others). If you don't need a new "thread", both models allow waiting for multiple things simultaneously.