Files
aji/docs/design/decisions.md
T
dev 4e4d753090 docs: reorganize documentation layout
- docs/roadmap/ -> docs/plan/ (implementation-plan.md becomes plan/README.md)
- docs/reference/design-decisions.md -> docs/design/decisions.md (+ DD-008..010)
- SPEC.md and docs/spec/INDEX.md merged into docs/spec/README.md
- new docs/design/open-questions.md: spec gaps found so far (Q-001..Q-018)
- new docs/dev/architecture.md and docs/dev/testing.md
- docs/README.md: layout, precedence, where new documents go
- update links in README, AGENTS, CONTRIBUTING, sources and test docs
2026-10-04 12:01:33 +03:00

60 lines
2.3 KiB
Markdown

# 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, 1 rejected, 2 usage/I/O, 3 not yet implemented).
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<N>/{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.