# Zig

Zig is a systems programming language created by Andrew Kelley, intended as a replacement for C with explicit memory management, no hidden control flow, and a single mechanism — [[comptime]] — covering generics, typeclasses, and metaprogramming.

## Design choices that come up repeatedly

**No hidden allocations.** Functions that allocate take an `Allocator` parameter explicitly. This is enforced by convention and by the standard library shape — there is no global heap to reach into. Encourages arena allocation patterns where ownership of a region of memory is the unit of management, not individual objects.

**No spooky action at a distance.** No operator overloading, no destructors that run implicitly (use `defer` to make cleanup syntactically visible), no implicit typeclass dispatch. The language refuses to insert behavior the reader can't see at the call site. See [[mean-free-path-language]] for the design framework this slots into.

**Comptime over macros and templates.** The same language runs at compile time as at runtime. Generics are `comptime` functions on types. Typeclasses are `comptime` functions that return a dictionary struct. There is no separate macro language.

**IO as an interface.** Zig 0.16 (April 2026) reworked the standard library so IO is an interface passed in via `init.io`, alongside the allocator. The author of [[zig-functional-programmers]] reads this as a Reader-monad shape arrived at independently — explicit effect carriers instead of a global runtime.

## Repo and links

- Compiler and language: <https://ziglang.org>
- 0.16 release notes: <https://ziglang.org/download/0.16.0/release-notes.html>
- Andrew Kelley's site: <https://andrewkelley.me>

## Anti-LLM contributor policy

Zig has one of the strictest LLM-contribution bans in major open source: no LLM-authored issues, PRs, or bug-tracker comments, including translation. The rationale is that maintainer review time is investment in growing trustworthy contributors — see [[contributor-poker]] — and LLM-authored PRs receive that investment without producing the long-run benefit. Even native-language posts are preferred to LLM-translated ones. The visible cost is that [[simonw-zig-anti-ai|Bun's 4× compile-speed Zig fork won't be upstreamed]].

## Coverage in the wiki

- [[zig-functional-programmers]] — A Haskeller evaluates Zig on three axes (domain expressiveness, type-system programmability, mean-free path) and finds it scores well on all three.
- [[simonw-zig-anti-ai]] — Simon Willison's coverage of Zig's anti-LLM policy and the Bun fork situation
- [[contributor-poker]] — Loris Cro's framing of why the policy is structurally about contributor growth, not code quality
- [[signed-vs-unsigned-sizes]] — Zig kept C's unsigned-`usize` convention; the C3 retrospective groups it with C/C++/Rust as having made the same mistake
- [[toolbox/moonstone|moonstone]] — a Lua environment and package manager written in Zig, one of the tools built on it
- [[gingerbill-blog]] — Ginger Bill (Odin creator), an adjacent opinionated-defaults systems-language voice
