What Zig felt like, coming from Rust

241 points · 293 comments on HN · read original →

Points and comments are a snapshot, not live.

A Rust developer rebuilds a JSONPath library in Zig, contrasting the two languages' approaches.

The author ported a JSONPath library (RFC 9535) from Rust to Zig, noting Zig's minimal IDE support and flat project structure. They preferred Rust's functional style over Zig's imperative approach, especially for monadic transformations and immutable data. Memory management in Zig requires explicit init/deinit discipline; errors like forgotten deinit or double frees are caught by test allocators but are absent in Rust due to Drop. Zig's ecosystem is immature-libraries like regex lack Unicode support. Despite these differences, the author found Zig straightforward, modern, and fast, seeing it as a potential C successor.

What commenters are saying

Commenters split on the article's quality. Several detected AI-assisted writing (e.g., em dashes, 'caveat worth stating,' repetitive intensifiers), with one noting a disclaimer at the bottom about AI use for styling and error handling. Others focused on substantive points: skepticism about Zig's allocator obsession (calling it overhyped for real-world software) versus defense from game developers who use custom allocators extensively. No strong consensus emerged; some valued the Rust-vs-Zig comparison despite stylistic concerns.