←back to thread

Zig is hard but worth it

(ratfactor.com)
401 points signa11 | 3 comments | | HN request time: 0.814s | source
Show context
sarchertech ◴[] No.36151194[source]
I tried Zig for a few weeks but ended up choosing Odin for a game dev side project I’m working on. Odin feels a lot more high level, but still gives you low level control when you need it.
replies(1): >>36151810 #
59nadir ◴[] No.36151810[source]
I've settled on Odin as well and I think it's currently way ahead for game development than Zig is. Even for other things I'm currently more likely to write it in Odin, despite writing Zig from 2019 to 2022. The reasons really come down to error handling being better in Odin overall with payloads being attachable to errors as well as the context system and zero values making it relatively painless to really only talk about the things that need talking about and letting the rest be unsaid.

There are also several similarities: Custom allocators as part of the ecosystem and language, no RAII, easy ways to propagate and handle errors the right way, tagged unions with table stakes like exhaustiveness checking.

I think Odin and Zig have some fundamental differences (and plenty of similarities) and when trying Odin out I was surprised to find that I preferred the Odin way overall.

For gamedev stuff Odin wins due to a few things; swizzling on a code level is super nice, array programming built-in to the language, vendor libraries shipped with the language that allow you to just get going almost no matter what you're doing, and so on.

replies(1): >>36152362 #
truckerbill ◴[] No.36152362[source]
I want to invest in Odin but I see the velocity and growing mindshare that Zig has and I wonder if it's not better to settle for that. Also how do you find the compile times?
replies(3): >>36152942 #>>36154264 #>>36158510 #
1. mr_00ff00 ◴[] No.36154264[source]
Just looked at Odin and I really like the syntax, but I feel the same way. I feel like the community and ecosystem is the key elements and zig seems to be headed in the direction to grab that.
replies(1): >>36154844 #
2. sarchertech ◴[] No.36154844[source]
They’re very different languages despite having some similar capabilities.

I also found the game dev libraries in Odin far easier to use then the ones in zig.

replies(1): >>36155064 #
3. mr_00ff00 ◴[] No.36155064[source]
Yeah I did briefly look for zig game libraries and couldn’t find much.

I see the basic differences, but I’ll have to dig deeper.