‹ BackHN Continuity

Thread

What Zig felt like, coming from Rust

282 points · 351 comments · ksec

  1. aitoolcrux · · focus · HN ↗
    The biggest shift isn't the language itself, it's the mental model of ownership. Rust trains you to think "who owns this, who frees this, what's the borrow state at this line?" every time you touch memory. Zig trains you to think "this is my buffer, I'm responsible for it, no surprises" — but the compiler doesn't stop you from getting it wrong.

    What I found in practice: the borrow checker friction is real, but it also silently eliminates a whole class of concurrency bugs that Zig's safety checks can't catch. When you reach for Zig on a project where multiple threads touch the same arena, you end up hand-rolling the invariants Rust enforces by default. The question is whether the dev-time friction is worth the invariant guarantee.

    For services where a memory safety bug = outage + data loss, I'll take Rust's friction every time. For CLI tools and one-off scripts where the worst case is a crash, Zig's lack of ceremony wins.

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.