revision 2 per owner review: reserved-feature dependencies may change until publication (general rule, DD-014); task.join.cancel returns the handle on cancelled with loans still LOANED; channel.sender.dup from ref<sender<T>> (MPSC, receiver_dup reserved); task.wait required by every suspending operation, task.join included, only in modules declaring cancellation; sent values and handles come back as block parameters on closed/cancelled edges; explicit channel states spec 04 §37-§41 and pointers in §11-§16, §35, §36; spec 05 §9, 07 §8.11, 07a, 08 §14, 11 §6-§7; features cancellation, channels, sync published (implementation pending); rwlock, channel_transfer, receiver_dup, guard_transfer reserved; effect task.wait; E4304, E4305; Q-013 resolved; bundle +15.8 % tokens (recorded)
147 lines
11 KiB
Markdown
147 lines
11 KiB
Markdown
# 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 | resolved | P1 | Borrow lifetimes in AIR |
|
||
| Q-010 | resolved | P1 | Region generation checks: static, dynamic, or both |
|
||
| Q-011 | resolved | P2 | Effect hierarchy and discharge |
|
||
| Q-012 | resolved | P2 | Capability representation and host instantiation |
|
||
| Q-013 | resolved | P3 | Deterministic `select` rule and scheduler seed |
|
||
| Q-014 | resolved | 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-019 | resolved | P3 | Non-terminating programs in test tooling |
|
||
| Q-020 | resolved | P2 | Size bound for SSA array values |
|
||
|
||
## 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<io.write>` (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.
|
||
|
||
**Resolved (RFC 0005):** second-class borrows; returns use `from %param`; explicit `borrow.end` with path linearity (spec 07 §8.8, spec 08 §11).
|
||
|
||
## 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.
|
||
|
||
**Resolved (owner decision, RFC 0005):** static checks only; no runtime generation checks in safe code (spec 03 §8.1). Specified in detail with `regions` in Phase 2.
|
||
|
||
## 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.
|
||
|
||
**Resolved (RFC 0006):** effects are flat atoms from a closed registry; no implication and no discharge in format 0; function pointer types must carry effect sets (spec 05 §9).
|
||
|
||
## 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.
|
||
|
||
**Resolved (RFC 0006):** `cap<K>` is an opaque, copyable reference to a shared host authority object; it enters only as a named `@main` parameter bound by `--grant name=kind[:scope]`; `cap.narrow` is the only, fallible, transformation; failed instantiation is `not_instantiated` (exit 6) (spec 05 §10).
|
||
|
||
## 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.
|
||
|
||
**Resolved (RFC 0012, spec 04 §39):** ready arms chosen by a draw from the schedule generator (not textual order); task choices and arm choices share one stream and one `choices` count. The schedule seed was settled by RFC 0011.
|
||
|
||
## 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.
|
||
|
||
**Resolved (RFC 0011):** `Send`/`Share` are structural; every capability kind is `Send` and `Share`, so an aggregate holding capabilities is `Send`/`Share` exactly when its other members are (spec 04 §35).
|
||
|
||
## 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`).
|
||
|
||
## Q-019 — Non-terminating programs in test tooling
|
||
|
||
A program may legitimately loop forever, so the language cannot bound execution. The conformance runner and `ajid` still need a way to stop a run without making the outcome depend on wall-clock time. Options: a deterministic step budget that is a tooling parameter (reported as "budget exhausted", never as a language trap), or explicit `fuel:` in test headers. Must be decided before scheduler stress tests (P3), which multiply run counts.
|
||
|
||
**Resolved:** deterministic instruction fuel (spec 11 §7). Wall-clock time is never used to determine semantic test termination. Fuel exhaustion is an execution-runner outcome (`limit_exceeded`, CLI exit code 5), not an Aji trap.
|
||
|
||
## Q-020 — Size bound for SSA array values
|
||
|
||
Frame storage is bounded (`max_local_frame`, spec 08 §11.5), but an SSA value of type `array<T, N>` (for example from `array.splat`) is bounded only by `N ≤ 2^32`. A module can therefore ask the interpreter for gigabytes in one instruction, and the outcome then depends on host memory. Options: apply the same accounted-size limit to every type in the module (E5101), or a separate `max_value_bytes`. Needs an owner decision; changing it later would turn accepted modules into rejected ones, so it should be settled before format 0 is released.
|
||
|
||
**Resolved (owner decision, DD-015):** `max_value_size` = 1 048 576 bytes bounds the accounted size of every materializable type in a module (spec 08 §7.1); `max_local_frame` stays a separate limit. Both are normative, deterministic, independent of host memory and reported as `E5101`. Accounted sizes use checked arithmetic; overflow is `E5101`. Total allocation is a Phase 2 concern (allocation capabilities and runtime limits).
|