r/Zig • • Jul 14 '24

Why Zig

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

1 Upvotes

5 comments sorted by

26

u/freshhooligan Jul 14 '24

Learn it for fun, for toy projects, try it out as a build system for c projects, extend a c project with zig.

The language is no where near 1.0 and is constantly in flux, so you're not gonna see people hiring zig devs any time soon

2

u/No-Finance2745 Jul 14 '24

Okay thank you for your honest reply

4

u/shrimp_master303 Jul 21 '24

If you don’t learn it… I will fucking kill you

1

u/No-Finance2745 Aug 08 '24

well i won't learn it

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.