Zig is just C with a marketing push. Most developers already know C.
Zig is just C with a marketing push. Most developers already know C.
I really don't need this kind of self-enlightenment rubbish.
What if I read the whole book and felt no change?
I think I understand SoA just fine.
Zig also encourages you to "think like a computer" (also an explicit goal stated by Andrew) even more than C does on modern machines, given things like real vectors instead of relying on auto vectorization, the lack of a standard global allocator, and the lack of implicit buffering on standard io functions.
I would definitely put Zig on the list of languages that made me think about programming differently.
And agree with allocators; in C I always considered using custom allocators but never really needed to. Having them just available in the zig std means I actually use them. The testing allocator is particularly useful IMO.
Never used Go but if it's Zig-like I might give it a shot! Thanks!
- structs and functions are the main means of composition
- the pattern of: allocate resource, immediately defer deallocating the resource
- errors are values, handled very similarly (multiple return values vs error unions)
- built in json <-> struct support
- especially with the 0.16.0 Io changes in Zig, the concurrency story (std.Io.async[0] is equivalent to the go keyword[1], std.Io.Queue[2] is equivalent to channels[3], std.Io.select[4] is equivalent to the select keyword[5])
- batteries included but not sprawling stdlib
- git based dependencies
- built in testing
[0] https://ziglang.org/documentation/master/std/#std.Io.async[1] https://go.dev/tour/concurrency/1
[2] https://ziglang.org/documentation/master/std/#std.Io.Queue
[3] https://go.dev/tour/concurrency/2
[4] https://ziglang.org/documentation/master/std/#std.Io.select