HeadlinesBriefing favicon HeadlinesBriefing.com

Zig vs Rust: A Developer's Honest Take

Hacker News •
×

After 7 years as a Rust developer, I decided to explore Zig by reimplementing a JSONPath library I had built in Rust. The goal was to compare the two languages fairly, using a real project that the community could use. My experience with Zig was shaped by habits carried over from Rust, and some decisions were not optimal, but the journey offered valuable insights.

One of the first surprises was the lack of IDE support in Zig. Coming from Rust Rover and JetBrains tools, I had to rely on command-line tooling. This turned out to be a refreshing change, as build.zig made it easy to run tests and debug. The simplicity of the CLI workflow was a welcome shift, and it even inspired me to move away from full IDEs to a helix + alacritty + zellij setup.

Zig's flat file structure was another notable difference. While Rust encourages deep folder hierarchies, Zig nudges toward flatter layouts. This was fine for my project, but I found that the threshold for needing a real hierarchy is much higher in Zig than in Rust. For a medium-sized project, keeping related code in one file worked well, and the simplicity was beneficial.

Overall, my time with Zig was eye-opening. It challenged my assumptions about systems programming and reminded me of the value of minimal tooling. While Zig may not replace Rust for me, it's a language worth watching for those who appreciate low-level control without the overhead.