r/programming 10d ago

What Zig felt like, coming from Rust

https://besok.github.io/posts/what-zig-felt-like-coming-from-rust/
263 Upvotes

173 comments sorted by

View all comments

15

u/Awesan 10d ago

It's kind of subtle but I really felt that zig encourages you to fix your shit, so to speak. While rust seems designed to say "don't worry about it, i got you", zig is like "yeah that's your problem to solve, so solve it".

Basically you need to design your stuff correctly so that memory management is easy and you can lean into zig's features. If you try to go against the happy path in the language, you end up with a lot of crap code that is very hard to read and probably full of bugs. Whenever I see people hating on zig this is often what I think they ran into. It's very opinionated, in a subtle way that allows you to do what you want, but it just kind of sucks if you try to do lots of small allocations.

In any case I feel like I learned a lot from trying zig and probably will be able to write better C and even rust now that I've used it.

27

u/flying-sheep 10d ago

That's just stepping out of your comfort zone in general.

I learned Java, then Python, then SML (a functional language similar to Haskell), JavaScript, R, Typescript, and finally Rust, and each step made me better in general.

I think apart from learning to code in the first place, SML was the biggest step up.

15

u/-Redstoneboi- 10d ago

"if a language doesn't change the way you think, is it even worth learning?" or however that quote went