←back to thread

Zig is hard but worth it

(ratfactor.com)
401 points signa11 | 2 comments | | HN request time: 0s | 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 #
Tozen ◴[] No.36158510{3}[source]
Part of "mindshare" are organizations pushing it on social media and marketing. Choose the language that solves your problems and that you like. Don't make a choice because a group is telling you what to like, is bullying others because they like something different, or are trying to shove something down your throat for their profit or benefit. Perfectly fine to have an independent mind, and make decisions best for you.
replies(1): >>36174577 #
1. truckerbill ◴[] No.36174577{4}[source]
Yes I definitely agree with that sentiment. Some things unfortunately happen faster with community support. Platform integrations, toolchains etc that require a lot of busywork. But I think I'll cautiously move with Odin regardless as I like how it's designed. Probably will end up learning both.
replies(1): >>36174997 #
2. 59nadir ◴[] No.36174997[source]
I think this is a great idea. I would suggest joining the Discord server if you want to talk to like-minded people and immerse yourself in the language: https://odin-lang.org/community/discord/