Preferences

I'll make a list of the things that both languages have in common that make them feel similar to me:

    - 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

[5] https://go.dev/tour/concurrency/5


This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal