# Open Questions Non-normative log of gaps and ambiguities in the draft spec. Each entry names the phase that is blocked until it is answered. Close an entry by changing the spec (or accepting an RFC) and recording the resolution here; do not delete entries. Status values: `open`, `resolved`. | ID | Status | Blocks | Question | |---|---|---|---| | Q-001 | resolved | P0 | Text AIR grammar | | Q-002 | open | P0 | Instruction contract tables | | Q-003 | resolved | P0 | Diagnostic codes for parse errors | | Q-004 | resolved | P0 | Observable trap semantics | | Q-005 | resolved | P0 | Verifier resource budget values | | Q-006 | resolved | P0 | Target description for `usize` and layout in the interpreter | | Q-007 | resolved | P0 | Integer edge cases besides overflow | | Q-008 | resolved | P0 | How `hello` writes output before capabilities exist | | Q-009 | open | P1 | Borrow lifetimes in AIR | | Q-010 | open | P1 | Region generation checks: static, dynamic, or both | | Q-011 | open | P2 | Effect hierarchy and discharge | | Q-012 | open | P2 | Capability representation and host instantiation | | Q-013 | open | P3 | Deterministic `select` rule and scheduler seed | | Q-014 | open | P3 | `Send`/`Share` derivation for aggregates holding capabilities | | Q-015 | open | P5 | Operational weak-memory model for the interpreter | | Q-016 | open | P0 | Floating-point determinism | | Q-017 | open | P5 | Replay file format | | Q-018 | resolved | P2 | Runtime diagnostics (traps) vs verifier diagnostics | ## Q-001 — Text AIR grammar Spec 07 shows illustrative AIR but no grammar. Undecided: comment syntax; constant spelling (`const.u64 0`?); type suffix convention on opcodes (`add.checked.u64` vs typed operands); module header and version/feature-bit declaration (spec 00 §5 requires them); how types, structs and enums are declared; canonical whitespace for the serializer. Proposed home: `docs/reference/air-text.ebnf` plus normative text in spec 07. **Resolved (P0-1):** `docs/reference/air-text.ebnf` and spec 07 §8. Comments use `;`; opcodes carry the type suffix (`add.checked.u64`, `const.u64 5`); the module header is four lines (`module`, `air`, `lang`, `features`). ## Q-002 — Instruction contract tables Spec 07 §4 and RFC 0004 require per-opcode contracts (operands, results, ownership/borrow transition, memory set, sync, effects, capabilities, traps, transfer function, interpreter behavior). None are written. Each phase must write the contracts for the opcodes it introduces before implementing them. Proposed home: a normative `docs/spec/07-air.md` appendix or `docs/spec/air/` per instruction family. **Partially resolved (P0-3):** format-version-0 instructions are specified in spec 07a. Stays open for the instructions of later phases. ## Q-003 — Diagnostic codes for parse errors The registry has no codes for malformed AIR text. Options: a new `E0xxx` range for syntax, or `E50xx` under AIR/verifier. **Resolved (P0-1):** new range `E0xxx` (E0001–E0006) for text and module errors. Undefined values and unknown block labels use the semantic codes `E5001` and `E5002`. ## Q-004 — Observable trap semantics Spec 01 §6 defines a trap as termination "according to runtime policy". The interpreter needs: trap kinds (overflow, assert, bounds, explicit, …), how a trap is reported (exit status, structured record), and whether the trap location is observable. **Resolved (P0-2):** spec 01 §6. Traps terminate the program and produce a record with a stable `T0xxx` code, function, block and instruction index. ## Q-005 — Verifier resource budget values Spec 08 §7 says budgets are "configured/spec-defined". A user-configurable budget would let a flag change which programs are accepted, which conflicts with "no compiler flags that change language semantics". Proposal: fixed spec-defined budgets per profile, reported in `E5101`. **Resolved (P0-2):** fixed, non-configurable limits in spec 08 §7. ## Q-006 — Target description in the interpreter `usize`/`isize` match the target pointer width (spec 02 §1) and struct layout is implementation-defined (spec 02 §7). For determinism the interpreter must run against an explicit target description. Undecided: format, default, and whether it is part of the AIR module (spec 00 §5 "optional target requirements"). **Resolved (P0-2):** spec 09 §9. Target description with `pointer_bits`; the interpreter defaults to `air64`. `usize`/`isize` are never `widen` operands, so verification is target-independent. ## Q-007 — Integer edge cases besides overflow Unspecified: division and remainder by zero; signed `MIN / -1`; shift amounts ≥ bit width; signed right shift; casts between widths and signedness (spec 01 §2 forbids implicit conversion but explicit cast semantics are absent). **Resolved (P0-2):** spec 02 §2.1 and spec 07a. ## Q-008 — `hello` before capabilities Phase 0's exit criterion runs AIR `hello`, but `io.stdout_write` needs `cap` (Phase 2). Options: bring a minimal `io.write` capability and intrinsic into Phase 0, or define Phase 0 `hello` as a function whose return value the test harness checks. **Resolved (P0-2):** Phase 0 `hello` is a `@main` that returns a value which `aji run` reports (spec 07a "Run result"). A `hello` that writes to stdout moves to P2-11, after slices (P1) and capabilities (P2). ## Q-009 — Borrow lifetimes in AIR Spec 03 §4 shows `'a` lifetimes in source; AIR has `borrow.ref`/`borrow.end` but no notation for lifetime relationships across function signatures. Undecided: explicit lifetime parameters in AIR signatures vs scope-based borrows only. ## Q-010 — Region generation checks Spec 03 §8.1 allows removing generation checks "when statically proven unnecessary", implying a dynamic check otherwise; `E2104` implies static rejection. Undecided: which cases are static errors, which compile to runtime checks, and what the runtime failure is. ## Q-011 — Effect hierarchy and discharge Spec 05 §2 lists effects such as `atomic` and `atomic.weak`, `io.write` and `fs.write`. Undecided: whether effects form a hierarchy (does `atomic` cover `atomic.weak`?), and what a "verifier-recognized boundary" that discharges an effect is. ## Q-012 — Capability representation and host instantiation Binary AIR has a `CAPABILITY_TABLE` (spec 07 §6). Undecided: how capabilities appear in text AIR, how an entry point declares the capabilities it needs, how the host/interpreter grants them, and how narrowing (spec 05 §4) is expressed. ## Q-013 — Deterministic `select` and scheduler seed Spec 04 §14 and spec 11 §6 require a stable rule in deterministic mode but do not define it. Also undecided: scheduler seed format and which choice points are recorded. ## Q-014 — `Send`/`Share` for aggregates holding capabilities Spec 02 §6 derives properties structurally; spec 05 §5 says capability types define their own transfer rules. Undecided: the derivation for a struct mixing ordinary fields with `Local` or move-only capabilities. ## Q-015 — Operational weak-memory model The SB litmus test requires the interpreter not to forbid `r1=0, r2=0` under relaxed ordering. Undecided: which executable model to use (store buffers, a promising-style semantics, or an axiomatic checker over recorded executions) and how much of C11's model to adopt. ## Q-016 — Floating-point determinism `f32`/`f64` exist (spec 02 §1) with no rules on NaN payloads, fused operations, rounding mode or denormals. Deterministic replay requires these to be fixed. ## Q-017 — Replay file format Spec 11 §4 mentions `.ajr` files without a format or compatibility rule. ## Q-018 — Runtime diagnostics The error registry covers verifier/compiler errors. Traps and runtime check failures (bounds, generation, overflow) need stable machine-readable records too, either in the same registry (e.g. `R` codes) or a separate one. **Resolved (P0-2):** traps share the registry in a separate `T0xxx` range (`docs/reference/error-codes.md`).