air: feature negotiation for AIR format 0 (DD-014)
- reference/air-features.md: normative feature registry (arrays, atomics, capabilities, channels, effects, islands, ownership, regions, sync, tasks; all reserved), dependency closures, reasons for E0006 - spec 07 §8.1/§8.5/§8.7: features are mandatory, validated before the body, full dependency closure declared, sorted canonically; every extension belongs to a feature; published feature semantics immutable - spec 05 §8: features vs effects vs capabilities - src/air/features.zig: registry, validation, sync test with the docs - parser validates features first; E0006 carries `reason` - `aji features` prints supported AIR format, language and features - conformance: unknown, reserved and duplicate feature tests - plan: feature publication tasks in phases 1-5
This commit is contained in:
1 parent
03dda1245a
commit
19dff5dd52
24 files changed
+366
-17
No files matched your search
@@ -0,0 +1,63 @@
|
||||
# AIR Feature Registry
|
||||
|
||||
Normative registry for the `features [...]` header of AIR format 0 (spec 07 §8.1, §8.7). `src/air/features.zig` mirrors this table; a unit test fails if they drift.
|
||||
|
||||
## What a feature is
|
||||
|
||||
A feature is a coherent block of AIR semantics added to format 0 after the Phase 0 baseline: its types, instructions, verifier rules, diagnostics and interpreter behavior. A module that declares a feature tells the implementation: *to verify and execute this module you must understand these semantics.*
|
||||
|
||||
Features are not build options. Three concepts stay separate:
|
||||
|
||||
| Concept | Question it answers | Where |
|
||||
|---|---|---|
|
||||
| feature | what the AIR implementation must understand | module header `features [...]` |
|
||||
| effect | what a function does | function `effects [...]` (spec 05) |
|
||||
| capability | what an invocation is allowed to do | `cap<…>` values (spec 05) |
|
||||
|
||||
Declaring `features [capabilities, effects, ownership]` grants no authority. It only states that the module uses capability semantics.
|
||||
|
||||
## Rules
|
||||
|
||||
- `features []` is the Phase 0 baseline.
|
||||
- Every post-baseline construct belongs to exactly one feature. A feature is a whole semantic block, not one instruction.
|
||||
- A module MUST declare every feature whose constructs it uses, plus the full dependency closure; nothing is implied.
|
||||
- Canonical form: names sorted lexicographically, no duplicates.
|
||||
- Status `reserved`: the name and dependencies are fixed, semantics are not yet specified; modules MUST NOT use it (`unsupported_feature`).
|
||||
- Status `published`: semantics are specified in spec 07a and the relevant spec files, and are immutable. Incompatible evolution needs a new feature name or a new AIR format version.
|
||||
- A dependency is listed only when the feature's semantics cannot be stated without it.
|
||||
|
||||
## Registry
|
||||
|
||||
| Feature | Status | Phase | Depends on | Semantic block |
|
||||
|---|---|---|---|---|
|
||||
| `arrays` | reserved | 1 | — | fixed-size arrays `[T; N]`, checked indexing |
|
||||
| `atomics` | reserved | 5 | `ownership` | atomic types, the five orderings, fences, `atomic.*` instructions |
|
||||
| `capabilities` | reserved | 2 | `effects`, `ownership` | `cap<…>` values, narrowing, delegation, capability-gated intrinsics |
|
||||
| `channels` | reserved | 3 | `ownership` | bounded and rendezvous channels with ownership transfer |
|
||||
| `effects` | reserved | 2 | — | effect checking of `effects [...]` lists (E3101) |
|
||||
| `islands` | reserved | 4 | `ownership`, `regions` | `Island<T>`, `iref<T>`, transfer, freeze, `Frozen<T>` |
|
||||
| `ownership` | reserved | 1 | — | `Own<T>`, `move`, `ref<T>`/`mut<T>` borrows, slices, initialization, linearity |
|
||||
| `regions` | reserved | 1 | `ownership` | `Region`, generations, region allocation, reset and destroy |
|
||||
| `sync` | reserved | 3 | `ownership` | `Mutex<T>`, `RwLock<T>`, linear guards |
|
||||
| `tasks` | reserved | 3 | `ownership` | structured task scopes, spawn/join/cancel, `Send`/`Share` |
|
||||
|
||||
`capabilities` depends on `effects` so that every module that can perform an external operation is also effect-checked.
|
||||
|
||||
`effects` in the baseline: format-0 modules already carry `effects [...]` lines. Without the `effects` feature these lists are recorded but not checked; there is no effectful operation in the baseline, so nothing can escape checking.
|
||||
|
||||
## Diagnostics
|
||||
|
||||
Feature problems are reported as `E0006` (`module.unsupported_feature`) with a `reason` field, before the module body is examined:
|
||||
|
||||
| `reason` | Meaning | Extra fields |
|
||||
|---|---|---|
|
||||
| `unknown_feature` | name not in this registry | `feature` |
|
||||
| `unsupported_feature` | registered but reserved, or not implemented by this toolchain | `feature` |
|
||||
| `missing_dependency` | a dependency of a declared feature is not declared | `feature`, `requires` |
|
||||
| `duplicate_feature` | the same name is declared twice | `feature` |
|
||||
| `feature_not_declared` | the body uses a construct of an undeclared feature | `feature`, `construct` |
|
||||
| `reserved_type` | the body uses a reserved type such as `f32` (spec 07 §8.4) | `type` |
|
||||
|
||||
## Discovery
|
||||
|
||||
`aji features` prints the toolchain's AIR format, language version and supported features as one JSON object, e.g. `{"air":0,"lang":"0.1","features":[]}`. Agents query it before generating AIR.
|
||||
@@ -11,7 +11,7 @@ Draft registry. Codes are stable once released in a tagged compiler version.
|
||||
| E0003 | parse.duplicate_name | Function, type, block, field or variant name defined twice |
|
||||
| E0004 | parse.unknown_name | Unknown opcode, type, function, field or variant |
|
||||
| E0005 | module.unsupported_version | AIR format or language version not implemented |
|
||||
| E0006 | module.unsupported_feature | Required feature or reserved type not implemented |
|
||||
| E0006 | module.unsupported_feature | Feature unknown, unsupported, undeclared or dependency-incomplete, or reserved type used; field `reason` (reference/air-features.md) |
|
||||
|
||||
## E1xxx — Types and values
|
||||
|
||||
|
||||
Reference in new issue
Block a user