Though JS will still have the least boilerplate because of the way it handles types.
Though JS will still have the least boilerplate because of the way it handles types.
var wg = sync.WaitGroup
defer wg.wait()
wg.Add(1)
go func() {
defer wg.Done()
}
)And create a separate channel to return errors from a goroutine. Definitely more work.
No, you don’t. Any stack-allocated resources are freed when the function returns. WaitGroup is just there for synchronization.
Also I don't understand "it's not trivial to grow them". It is trivial to grow them, and that's why Go went this way. Maybe only 0.1% or fewer of use-cases will ever find any issues with the resizing stack (in fact probably the majority of uses are fine within the default starting stack size).
Well, guess how coroutines are implemented in Rust/C++/everywhere else!
Nonetheless, I do think that java virtual threads are superior for the vast majority of use cases and they are a good default to reach for for "async" like code.
Don't get me wrong, I like Java and don't very much like the Go language. But Java has a lot to improve upon still.
I don't really think it's fair to compare some old jboss monstrosity doing the job of a whole kubernetes cluster to a dumb hello world server written in go.
Sure, java startup time is and will probably always be worse than putting everything into a single binary - but it is way overblown in many discussions. I have a bunch of Quarkus services on my home server and they start up immediately.