Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: