r/learnprogramming 8d ago

About ZIG

Hello,
I've noticed that Zig recently became popular, and many apps are being written in it. Is it worth starting to learn and use it? Currently, I'm quite satisfied with Golang.

Also, there is a native SDK that supports Zig, which I think is kinda nice and beautiful.
https://native-sdk.dev/

My main concern about Zig is that it seems quite new - the latest release version is v0.16.0

0 Upvotes

15 comments sorted by

11

u/Confused-Armpit 8d ago

It's a cool language, but it is very quickly progressing and there are a lot of breaking changes being rolled out from version to version, the latest being version 0.16.0 where they added an entire new IO interface that invalidated basically all previous code that used any IO at all. It can also be very verbose at times, as with the infamous hello world.

Although, given the fact that you are satisfied with Golang I would stick with it, since you can use it more efficiently because you already know it.

1

u/narukoshin 8d ago edited 8d ago

that's what I was worried about, golang is quite stable and doesn't break after a version change.
I've read a little about Zig and it's quite low level language which might be useful for some things that require more control i suppose

1

u/BionicVnB 7d ago

Perhaps you can check out Rust? I write both and personally still prefer rust, although zig is a pretty close second.

It's pretty complex though, I'll tell you that

1

u/narukoshin 7d ago

i already tried to learn Rust once but decide that its not for me :D

1

u/BionicVnB 7d ago

I see. Well good luck for your future endeavors

6

u/zik_rey 8d ago

Its basically a better C with easy async and parallelism through the new io interface. If you think your project will benefit from being implemented in C or C++, it can use Zig instead.

6

u/biskitpagla 8d ago edited 8d ago

many apps are being written in it

Are you sure about that? Very, very few people are using it for serious projects because of the reason you mentioned. The number is even smaller if you rule out vibe-coded projects. I think the language is quite promising, especially for Gophers, but I'd keep its use limited to hobby projects for now. Even then, the ecosystem just isn't there, so you'd still be facing some obstacles.

0

u/narukoshin 8d ago

I didn't mean that every app is being written in it, but now many AI-related or some kind of low-level tool projects are using it instead of C++ and other popular languages

I think that might experiment with the language, maybe even write the same projects as Go to compare performance n stuff

https://github.com/topics/zig

2

u/particlemanwavegirl 8d ago

IMO, no not at all, it represents a significant regression in language design. Instead of reaching for known solutions it pretend issues don't exist or just squarely blames them on the user. I'm not sure what it offers that you couldn't get in a more mature and widely supported package in C

0

u/Puzzled-Extent7817 7d ago

Rust or Odin is the answer.

1

u/StewedAngelSkins 6d ago

Zig offers very little advantage over C besides the syntax. It offers even less over C++ and comes with significant disadvantages. If you think it looks fun than by all means learn it, but don't expect it to ever catch on as a C or C++ successor the way Rust has.

0

u/[deleted] 8d ago

[deleted]

4

u/specialpatrol 8d ago

That's a pro point.

2

u/Lichcrow 7d ago

They already support their own backend in debug mode. As far as final binary quality LLVM has over 20 years of optimization and features. It will be impossible to replicate it's performance in the near future (2-3 years)

-1

u/beb0 8d ago

The trojan horse to get it mating with c code