3 ms·
Go style concurrency can be also implemented in Zig, with the caveat that since Zig doesn't have a runtime / gc, you can't expect full 1:1 mapping with what Go
by kristoff_it 4y ago
Go style concurrency can be also implemented in Zig, with the caveat that since Zig doesn't have a runtime / gc, you can't expect full 1:1 mapping with what Go provides.
IMO the key point of Go's concurrency are channels, and those have already been implemented in Zig, with comparable semantics (eg blocking when the channel is full).
Here is how I use a channel (defined a few lines above) to implement the main loop of an interactive program I wrote:
https://github.com/kristoff-it/bork/blob/master/src/main.zig#L160-L267 https://github.com/kristoff-it/bork/blob/master/src/main.zig...