# Design Decisions This file records short decisions whose rationale does not yet justify a standalone RFC. ## DD-001 — Checked arithmetic by default Normal integer arithmetic traps on overflow. Wrapping/saturating arithmetic is explicit. Reason: release/debug behavior must not diverge, and arithmetic assumptions should remain visible to agents/verifier. ## DD-002 — No exceptions Errors are values. No stack unwinding. Reason: explicit CFG and resource cleanup are easier to verify and replay. ## DD-003 — No hidden destructors Cleanup constructs lower to explicit AIR edges. Reason: hidden control flow harms auditability and agent repair. ## DD-004 — Bounded channels by default Unbounded queues require explicit library choice. Reason: memory growth must not be implicit. ## DD-005 — No default atomic ordering Every atomic operation states its order. Reason: the compiler must not hide one of the most consequential concurrency choices. ## DD-006 — No arbitrary safe atomic pointer type initially Reason: reclamation cannot be separated from safe publication. ## DD-007 — Interpreter before optimizer/backend Reason: executable semantics and verifier behavior must stabilize before native-code complexity is introduced. ## DD-008 — Reference implementation pins one exact Zig version The toolchain version is pinned in `build.zig.zon` and `mise.toml` (currently 0.17.0) and upgraded deliberately in a dedicated change. Reason: Zig's standard library changes between minor versions; an unpinned toolchain makes builds non-reproducible (spec 12 §2). ## DD-009 — CLI diagnostics are JSON Lines on stdout `aji` writes one JSON diagnostic per line on stdout, human notes on stderr, and uses fixed exit codes (0 accepted or returned, 1 rejected, 2 usage/I/O, 3 not yet implemented, 4 trapped). Reason: agents consume diagnostics programmatically (spec 10); mixing prose into the machine channel breaks repair loops. ## DD-010 — Conformance tests are text AIR with a metadata header Tests live in `tests/conformance/phase/{accept,reject}/` with `expect`/`phase`/`spec` header lines that the runner strips before parsing. Reason: AIR is the conformance format (spec 07 §1), and keeping metadata out of the AIR grammar lets the grammar evolve independently of the test harness.