spec: accept RFC 0006 and integrate effects and capabilities

- spec 05 §9-§12: flat effects, checking rule, capability model,
  instantiation by parameter name, lifetime, fallible narrowing,
  intrinsic calls, runtime
- spec 07 §8.9, 07a (cap.narrow, intrinsic, run result), 08 stage
  order, 11 not_instantiated outcome
- new reference/effects.md and reference/capabilities.md (kinds,
  scopes, built-in cap_error)
- features effects and capabilities published
- Q-011, Q-012 resolved
This commit is contained in:
dev committed 2026-10-04 13:36:46 +03:00
1 parent 3fd1513c86
commit fb4338cea6
10 files changed
+245 -13

No files matched your search

+2 -2
View File
@@ -32,10 +32,10 @@ Declaring `features [capabilities, effects, ownership]` grants no authority. It
|---|---|---|---|---|
| `arrays` | published | 1 | `ownership` | `array<T, N>`, `slice<T>`, `slice_mut<T>`, `array.splat`, `borrow.index[.proven]`, `slice.*`, `guard`, bounds facts (spec 07a, spec 08 §12) |
| `atomics` | reserved | 5 | `ownership` | atomic types, the five orderings, fences, `atomic.*` instructions |
| `capabilities` | reserved | 2 | `effects`, `ownership` | `cap<…>` values, narrowing, delegation, capability-gated intrinsics |
| `capabilities` | published | 2 | `effects`, `ownership` | `cap<K>`, built-in `cap_error`, `cap.narrow`, `intrinsic`, instantiation of `@main` (spec 05 §10–§12) |
| `borrow_joins` | reserved | — | `ownership` | borrow-typed block parameters (spec 08 §11.6); unscheduled |
| `channels` | reserved | 3 | `ownership` | bounded and rendezvous channels with ownership transfer |
| `effects` | reserved | 2 | — | effect checking of `effects [...]` lists (E3101) |
| `effects` | published | 2 | — | flat effect checking of `effects [...]` for `call` and `intrinsic` (E3101, spec 05 §9) |
| `heap` | reserved | 2 | `capabilities`, `effects`, `ownership` | `Own<T>`, `own.alloc`, `own.free`, move-only values |
| `islands` | reserved | 4 | `capabilities`, `effects`, `ownership`, `regions` | `Island<T>`, `iref<T>`, transfer, freeze, `Frozen<T>` |
| `ownership` | published | 1 | — | frame storage `local<T>`, second-class borrows `ref<T>`/`mut<T>`, `from` returns, initialization (spec 07 §8.8, spec 07a, spec 08 §11, §13) |
+32
View File
@@ -0,0 +1,32 @@
# Capability Registry
Normative registry of capability kinds for AIR format 0 (spec 05 §10). A kind names the authority object a `cap<K>` refers to. An unregistered kind is `E0004`.
| Kind | Authorizes effects | Scope at instantiation | Narrowing forms |
|---|---|---|---|
| `clock.read` | `clock.read` | none | — |
| `fs.read` | `fs.read` | absolute path prefix | `prefix` (RFC 0007) |
| `fs.write` | `fs.write` | absolute path prefix | `prefix` (RFC 0007) |
| `io.read` | `io.read` | none | — |
| `io.write` | `io.write` | none | — |
| `mem.alloc` | `mem.alloc` | byte budget | `budget` (RFC 0008) |
| `mem.map` | `mem.map` | none | — |
| `net.connect` | `net.connect` | none | — |
| `net.listen` | `net.listen` | none | — |
| `net.read` | `net.read` | none | — |
| `net.write` | `net.write` | none | — |
| `process.env` | `process.env` | none | — |
| `process.spawn` | `process.spawn` | none | — |
| `random.read` | `random.read` | none | — |
Narrowing forms marked with an RFC are registered when that RFC is accepted; until then every `cap.narrow` form is `E3202`.
## Built-in enums
| Enum | Variants |
|---|---|
| `cap_error` | `invalid_restriction`, `not_subset`, `unsupported_restriction` |
## Instantiation
`aji run --grant <parameter>=<kind>[:<scope>]` binds one `@main` capability parameter. Every parameter needs exactly one grant of its kind and every grant must name a parameter (spec 05 §10.2). Scopes: path prefixes are absolute and contain no `.` or `..` components; byte budgets are decimal integers.
+27
View File
@@ -0,0 +1,27 @@
# Effect Registry
Normative registry of effect names for AIR format 0 (spec 05 §9). Effects are flat atoms: no effect implies another. In a module that declares the feature `effects`, an unregistered name is `E0004`.
| Effect | Authority required | Introduced by |
|---|---|---|
| `atomic` | none | Phase 5 |
| `atomic.weak` | none | Phase 5 |
| `clock.read` | `cap<clock.read>` | RFC 0007 |
| `ffi` | none (unsafe boundary, spec 13) | Phase 7 |
| `fs.read` | `cap<fs.read>` | RFC 0007 |
| `fs.write` | `cap<fs.write>` | RFC 0007 |
| `io.read` | `cap<io.read>` | RFC 0007 |
| `io.write` | `cap<io.write>` | RFC 0007 |
| `mem.alloc` | `cap<mem.alloc>` | RFC 0008 |
| `mem.map` | `cap<mem.map>` | later |
| `net.connect` | `cap<net.connect>` | RFC 0007 |
| `net.listen` | `cap<net.listen>` | RFC 0007 |
| `net.read` | `cap<net.read>` | RFC 0007 |
| `net.write` | `cap<net.write>` | RFC 0007 |
| `process.env` | `cap<process.env>` | later |
| `process.spawn` | `cap<process.spawn>` | later |
| `random.read` | `cap<random.read>` | RFC 0007 |
| `task.spawn` | none | Phase 3 |
| `thread.block` | none | Phase 3 |
| `thread.spawn` | none | Phase 3 |
| `unsafe` | none (unsafe boundary, spec 13) | Phase 2 |