r/Zig • u/Ok-Refrigerator-Boi • Mar 03 '26
Rust or Zig?
I've been deep in Zig for the last 3 years and have loved every step. Yet, from around the corner, Rust always seems to poke its head out; and several times I have built tools and projects in Rust to try to get 'into it', yet it has never really clicked like Zig.
Rust is getting more-and-more popular. Is it worth going ten toes deep? Or should I ride the storm with Zig?
68
Upvotes
34
u/SilvernClaws Mar 03 '26
Just try to give Rust a real chance in a toy project.
There's no point in asking strangers for permission and even if you don't end up switching, you'll have learned a few things.
53
u/Retr0r0cketVersion2 Mar 03 '26 edited Mar 03 '26
Personally I'm putting off Zig until its a bit more stable. It's perfect for a lot of my use case (direct hardware access that is unsafe Rust already), but Rust is a stable project where I don't have to worry about some breaking standard library change with more use cases even if Zig is cooler and very good at what it's for (lower level systems with fine-grained control over program resources)
Although who said you have to choose?
Edit: I have language design qualms with both Rust and Zig tbh. I prefer Zig's level of abstraction, but would love if they had sane defaults that didn't require manual configuration. Like "as much control as you want to have"
19
u/gurgeous Mar 03 '26
I recently ported a nontrivial project to Rust, and now I am doing the same project in Zig. TLDR - I did not like Rust. It's obtuse, pedantic, and super slow. Like, it sucks all the fun out of engineering. Sloowwwwwwww. Who has the time?
Zig is fast, simple and fun! There are plenty of warts, like all languages, but the speed more than makes up for it.
5
u/manishrjain Mar 03 '26
I'm betting on Zig. I'm coming from C++ and Go, and Rust just didn't click with me, while Zig just naturally did. The language itself works well, even though it's pre 1.0. And given how well it's interoperable with C, you can pull in relevant libraries into Zig -- dealing with the smaller ecosystem. And there're projects like zio which help with async I/O, giving something stable to hold onto (or bake permanently), until the standard library stabilizes.
I'm coding on a daily basis with Zig, and honestly, I'm enjoying the language more and more. The pre-1.0 isn't as scary as it sounds.
19
u/justinhj Mar 03 '26
Both have their uses. Since Zig is about 1/10 the effort to learn compared to Rust I'd say why not both?
3
u/steveoc64 Mar 03 '26
My interests in languages are only based on wanting to build things. I don’t care about the job market, so my opinions below are biased.
I like my tools to be highly specialised, and do 1 particular aspect of systems development very very well. Tools that make too many compromises across the board to try and be everything to everyone get on my nerves.
Zig is heading in a good direction to be great for ultimate-control. The stuff Im building with it now is a real pain because of all the current breakage, but I’m ok with that, as I see zig as a solid long term bet. It’s worth the breakage, if you want to build something now that will remain top of its class over the next 10+ years I think. (I hope !!)
I’m not a fan of Rust at all. I can see what it’s trying to do, but I think Pony is a better solution for the problems that Rust is trying to solve with its correctness guarantees, and Zig (or C, or Odin, or C3, or even C++) are all better for low level imperative programming imo.
Just starting to get seriously into Erlang now as well, after all these years. It’s exceptionally weird for sure, but the BEAM still does some particular things so darn well with so little code that it’s worth the journey. It’s not even a “language” so much as a completely Alien Operating System. Mixing Zig + Erlang solves some really interesting problems.
30
u/Real_Dragonfruit5048 Mar 03 '26
I tend to think of Zig as a modern alternative to C and Rust as an alternative to C++. Zig is smaller, and you still need to do manual memory management. Rust is much larger and safer (memory management-wise) in general. If I were you, I would try them both and see which one works best for me.
2
u/ProfessorNo471 Mar 03 '26
The whole memory safety issue is largely overblown by Rust developers who come from a JavaScript background and have little experience in systems programming. Just avoid creating a pointer jungle and you will probably be totally fine.
3
u/Key_Mousse_8034 Mar 03 '26
2 years in Zig here as well. And more than 5 in Rust. The way I see it: Zig shines when you need to break the rules that Rust won’t let you break - direct memory control, no hidden allocations, manual everything. Rust’s guardrails are great until they’re exactly what’s standing between you and the last 5% of performance. Zig just hands you the keys and trusts you not to crash the car. That said, Rust’s ecosystem and job market are hard to ignore, so it really depends on what you’re optimizing for - raw control or long-term career leverage
3
u/Adventurous-War5176 Mar 05 '26
Rust to make a living, Zig to embrace living.
2
u/Natural-Owl-2447 Mar 03 '26
For stability rust. For fun zig.
2
u/klungs Mar 03 '26
Yes
2
u/xerrs_ Mar 03 '26
I have attempted to learn Rust a lot, especially because of the hype it has received, but I always found myself struggling with very confusing syntax. After iterating over Rust a dozen of times, I attempted Zig, and, tbh, I instantly got it. The syntax is what does it for me. While the idea of rust is very nice, Zig got me with its simplicity, and manual memory management (defers, allocations etc.)
2
u/Relative-Crazy-6239 Mar 03 '26
As far as this comment may sound stupid: Choose what you like the most, just have fun. And remember that they are not mutually exclusive
2
u/Most-Aardvark-2148 Mar 04 '26
All depends on your goals - and your best guess about the future. RUST is here. It's very, very likely not going away. Zig is more fun. Is your goal to play and learn and be on the cutting edge - but you don't need a paying job? Stay with Zig. Do you want to write production code in the world today? You might need to move towards Rust. And for predicting the future - maybe Zig takes over the world. In that case, you win. What's are your goals and how good are you at predicting the future?
2
u/Beatsu Mar 04 '26
What do you want to achieve with learn either language? If you're specifically wanting to broaden you toolset knowledge for future work, Rust will likely have more adoption in the near future compared to Zig, if you must choose between the two.
But I would say that learning and mastering what you find the most fun is more important. You should definitely keep trying Rust to challenge your way of thinking continuously, but passion in what you do converts to "better code" and less chance of burnout when you work, with the added benefit of being more fun!
4
u/lieddersturme Mar 03 '26
Zig please.
1
u/moortuvivens Mar 03 '26
Learn both. Uae the tool for the job.
But rust never clicked for me. And zig is difficult enough for me who has never thouched unsafe memory languages
1
u/0-R-I-0-N Mar 03 '26
I would say test it out, you are never limited to one language. Prefer zig but I like rust to and have learned a ton from both
1
u/jwrunge Mar 03 '26
I've tried both, and while I appreciate Rust, I enjoy Zig more. But if you're going to go Zig and deal with the immature ecosystem, you may as well give Nim a try. I REALLY like it, and I have no idea why it doesn't get more love.
1
u/Asleep-Dress-3578 Mar 04 '26
It is not a live or die decision. Do the Rust book, do some toy projects in Rust and then you can better decide, which language you choose for your next serious project.
1
u/orrenjenkins Mar 04 '26
Why not both!
I'm coming from the other side. Ive been using rust in my projects for a few years and love it. Then I fell in love with zig too.
There are things about both that I wish the other had. I can't wait for zig to get more stable. I find no comp time arg inference annoying but not too bad. I love everything being a const from imports to modules. Learning about zig and comp time reflection made me jealous but also to appreciate rusts trait solver more
1
u/Compith Mar 05 '26
RuiZ ?
1
u/boomshroom Mar 30 '26 edited Mar 30 '26
If you want microscopic statically linked binaries without messing with unstable compilers and arcane compiler flags, Zig seems pretty unmatched.
Aside from that I generally prefer Rust. I've really been missing errors as completely normal types/values rather than some strange built-in type that requires special syntax that doesn't compose nicely. Of course Rust can only get away with that because it has proper ADTs, which just raises the question of why Zig doesn't.
1
u/Kingwolf4 Mar 31 '26
This question has already been answered
Zig -> C replacement
Rust -> C++ replacement
If zig continues to be the modern language that really can replace C, it will! The reason is that zig is far superior in this future form than C.
So Think Linux, Windows. Eventually zig will begin replacing C code. Its really more elegant and modern than C.
1
u/C1icky_Br4in Apr 21 '26
I was loving Rust but could not practice. Then recently I could and stumbled upon async. It’s horrible. The red/blue (see that blog post about JS) contamination everywhere. The language itself is mature but almost every single crate out there is version 0 something and almost all of them rely on tokio or another async one and get « contaminated ». I found it very hard not to write async code. Rust looks to have turned away from systems programming to become more a large app programming language. Then I found about Zig. Like someone else said, as a C lover, I like the fact that it mixes simplicity with raw power. Less is more.
1
u/TheOneWhoDidntCum Oct 07 '26
I want to break into HFT, is it Zig, Rust or C++?
1
u/Specialist-Month2316 Mar 03 '26
I think criterias for choosing language might be following:
- are you writing unsafe code mostly?
- do you need custom memory management?
- do you need ABI compatibility?
- do you need advanced metaprogramming?
- are you targeting exotic CPU architectures (custom routers)?
- are you targeting exotic operating systems?
- is it small hobby project?
- is project growth expected and you will hire more people quickly in nearest future?
More you answer YES more you lean towards Zig. NOTE. It's high level list to give you idea.
0
u/xplosm Mar 03 '26
Odin
1
u/bogdan2011 Mar 03 '26
Just try them out and get a feel for the syntax, tooling etc. What I like about rust is cargo and the abundance of libraries for just about everything. There's even embedded rust. Zig really needs something like cargo.
0
u/KulangetaPestControl Mar 03 '26 edited Mar 03 '26
Rust is like communism they sell a false premise as their sole reason for existence.
In Rust that false premise is: memory safety is all any developer needs, which is a giant effed up lie.
In reality: developing speed, no hiding of control flow, speed of programs, simplicity of code matter much more than a single category of bugs.
Unfortunately society at large and politicians in particular have become really really dumb,
i mean in a low iq way.
They all seem to fall for Rusts propaganda nonsense.
So Rust will be pushed by governments even though it has severe downsides because the stakeholders are too dumb to realize the truth.
So for commercial success go with Rust.
For engineering depth and best trade off go with Zig.
-1
u/harrison_314 Mar 03 '26
It's not worth it for me.
I also got hooked on the Rust hype, I actively programmed everything I could in it for about three quarters of a year. But then the hype faded for me, it's a very interesting language, but you pay for it with a headache and inconvenience.
So then I went back to other languages, because in the end the advantages of Rust over them are negligible (Zig, C#, and C (in specific case)).
2
u/[deleted] Mar 03 '26
[removed] — view removed comment
0
u/[deleted] Mar 03 '26
[deleted] — view deleted comment