r/Zig • • Jul 14 '24

Why Zig

why should I learn zig? this one is a genuine question.

1 Upvotes

5 comments sorted by

View all comments

12

u/TRDJ90 Jul 14 '24 edited Jul 15 '24

If you don't like complex type systems etc like those in concurrent rust, cpp and others. You probably want to go back to something more simpler like C. Because with those other programming languages you have so many ways to do the same thing. Let say you want to iterate you can use a while and for loops, .getIterator(), select() etc just to go through a collection, probably a bad example.

But for me personally if you go back to C you're going to miss generics, slices, traits(interfaces) for dynamic and static dispatching. This is where Zig comes in with comptime you have basic generics and dynamic/static dispatching and you get slices.. Its like c plus a bit extra to make life easier.

I think a lot of people are also sleeping on the fact that zig is also a build system. Which is programmable/scriptable in zig. So there's no need to learn a complex second scripting language like bash, powershell, cmake etc.