Hacker News front page11 min readintermediate
What Zig felt like, coming from Rust
Summary
A Rust veteran recounts porting a JSONPath library to Zig, highlighting differences in IDE support, project layout, testing ergonomics, functional vs imperative idioms, and Zig's explicit allocator model.
- Zig’s tooling is minimal; most work happens via the CLI and a simple `build.zig` workflow.
- Zig encourages a flat source tree, reducing folder depth compared to typical Rust projects.
- Testing in Zig is possible but feels more verbose; the author preferred in‑file tests wired through `build.zig`.
- Functional patterns common in Rust (monadic error handling, immutable pipelines) translate to imperative, mutable code in Zig, though sum types and compile‑time duck typing survive.
Understanding these practical trade‑offs helps engineers decide when Zig’s low‑level control outweighs the productivity gains of Rust’s richer ecosystem, especially for libraries that need tight memory management or minimal runtime.
6/10
