top | item 33368785

(no title)

username-404 | 3 years ago

Go handles concurrency via goroutines whereas in Zig... I couldn't find any available information. All it says in their docs "it's an area of active research".

discuss

order

kristoff_it|3 years ago

Thank you for asking!

Zig has stackless coroutines, I wrote a blog post that explains how it all works at a high level:

https://kristoff.it/blog/zig-colorblind-async-await/

armitron|3 years ago

"I think goroutines are preferable in that context because async/await is a much lower level tool that is easy to misuse, but when it comes to writing code with critical requirements of correctness and efficiency, you need async/await and you need Zig’s philosophy that we all should strive to write robust, optimal, and reusable software."

I don't see how this follows. Async/await is a disaster in every way, M:N threading (which Goroutines are an implementation of) is the way to go. Not only does one get sane concurrency but also parallelism. Look at Ada tasks and Erlang processes for writing parallel code with critical requirements of correctness and efficiency.