Zig by Example

State of “Zig by Example”

  • Targets Zig 0.14; commenters note major changes since then (printing/formatting “writergate”, build system, C interop).
  • Several say examples don’t compile on current Zig; consider it at least ~2 years out of date and “very brief” / too simplistic.
  • Multiple people assert it appears AI-generated and therefore unreliable for learning.

Alternative Zig Learning Resources

  • Frequently recommended:
    • Learning Zig (online book), zig.guide.
    • “Introduction to Zig” (project-based online book).
    • Ziglings (interactive exercises; kept up to the latest release; listed on the official Zig site).
    • Official “Why Zig over Rust/D/C++” page.
    • TigerStyle docs from the Tigerbeetle project as a style/best-practices reference.
    • zigdoc and ziglint plus zig fmt for tooling.

Versioning, Stability, and Tooling

  • Pain point: many Zig projects need a specific compiler version; mismatch with local install or between projects is common.
  • Some call this a “major miss,” others say: it’s pre-1.0, instability is expected and accepted by early users.
  • Comparisons to Rust editions, which allow mixing versions; Zig lacks an equivalent.
  • Suggested mitigations: use version managers/isolated environments (mise, Nix, Docker, etc.).

Whether to Learn Zig (vs. Rust/C/C++)

  • Pro-Zig views:
    • Simpler, closer to C (with some Go-like aspects), easier to understand what the machine does.
    • Good fit for high-level developers occasionally dropping to low-level for performance, due to simple syntax and strong toolchain/cross-compiling.
    • Even if it stays niche, knowledge transfers to general systems understanding.
  • Skeptical views:
    • Rust already fills most of the “modern systems” space, with memory safety and strong industry push.
    • Zig is unsafe, unstable, and may remain niche or follow D’s trajectory; C remains the dominant systems language.
    • For deep systems learning, C (and maybe Rust) is preferred; Zig may feel redundant if you already know C well.
    • Some question treating languages as long-term “investments”; others counter that fluency and keeping up with changes are real costs.

Language Design, Syntax, and Concurrency

  • Some dislike .{}
    • Viewed as noisy when used for arguments and default/optional/variadic patterns.
    • Complaints about having to explicitly discard unused return values.
  • Defenders explain:
    • .{} is inferred struct/tuple construction, often less verbose than naming types.
    • Explicit discard is intentional for catching bugs.
  • Concurrency model:
    • Said to be broadly Go-like: queues instead of channels, async/concurrent APIs instead of go keyword, and a select-like construct.
    • Some lament the lack of coverage in the example material.

AI, Ecosystem, and LLM Support

  • There’s tension around AI:
    • Some criticize Zig’s project-level bans on AI-generated contributions and the “anti-AI” crowd as harmful to adoption.
    • Others clarify you can freely use AI to write Zig applications; restrictions mainly apply to Zig’s own codebase.
  • For better Zig-in-LLM support, suggestions include:
    • Integrating with the Zig language server, local docs, and source as canonical references.
    • Building MCP servers/tools to query docs, linters, formatters (zig fmt), and real-world codebases.
    • Using Zig project histories as benchmarks to grade AI-generated PRs.
  • A few express that AI has made Rust more approachable and fear Zig may miss that wave; others argue you can always just ask an LLM directly instead of consuming AI-generated tutorials.

Adoption, Community, and Motivation

  • Perceptions vary:
    • Some see Zig as promising due to toolchain, C interop, and a strong standard library.
    • Others predict it will remain niche, with limited corporate adoption and a community sometimes described as hostile or elitist.
  • Usage anecdotes:
    • Hobbyists and non–C/C++ professionals using Zig for drivers, FFI layers, and side projects.
  • One commenter questions whether Zig still “matters” in the AI era and reports loss of motivation to keep learning it.