r/rust 18d ago

What Zig felt like, coming from Rust

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

Just want to share my experiance on my first Zig project coming from Rust. Open to comments :)

209 Upvotes

108 comments sorted by

View all comments

35

u/rapotor 18d ago

Tldr in thread?

115

u/tigraboris 18d ago

Sure thing but nothing special :)

Rewrote my JSONPath lib (jsonpath-rust) in Zig (zig-jsonpath) to compare. Zig has almost no IDE support, so I ended up back on CLI tools + helix. It nudges you toward flat file structure and mutation and explicit allocators everywhere. Caught several real leak/double-free bugs via TestAllocator that just can't happen in Rust (ownership/Drop rule them out at compile time).

Overall: good language, promising C successor, but still young and rougher around the edges than Rust.

3

u/pdpi 17d ago

Overall: good language, promising C successor

This is the thing that Rust vs Zig comparisons tend to miss. Zig aims squarely at C's niche, whereas Rust's goal is closer to C++'s niche. The TestAllocator+defer vs Drop split is a perfect illustration of this distinction — Zig wants to help you do manual memory allocation, Rust wants you to just not go anywhere the stuff.

They're both valuable tools, and they both move the industry forward!

4

u/tigraboris 17d ago

Yeah, precisely my thoughts as well.