spec: accept RFC 0005 and integrate Phase 1 memory model (P1-1, P1-2)

- RFC 0005 Accepted (revision 2)
- spec 07 §8.8 types and syntax; spec 07a contracts for features
  ownership and arrays; spec 08 §11-§14 borrows, facts, initialization,
  stage order; spec 03 frame storage, second-class borrows, static
  region generations
- grammar: from-returns, multi-result, new types and opcodes
- feature registry: ownership and arrays published; heap added and
  regions moved to Phase 2; borrow_joins reserved and unscheduled
- codes E2105-E2108, T0008
- Q-009, Q-010 resolved; Phase 1 and Phase 2 plans updated; Own test
  moved to phase 2
This commit is contained in:
dev committed 2026-10-04 13:10:08 +03:00
1 parent 2c84c0c7cf
commit 48bb50724f
15 files changed
+269 -55

No files matched your search

+21
View File
@@ -253,3 +253,24 @@ A change is permitted under `air 0` only if all of the following hold:
A published feature's semantics are immutable. Extending a feature with new semantics is not permitted; register a new feature instead.
Any other change to format 0 — a different meaning, typing rule, trap behavior, diagnostic code or canonical spelling for an existing construct — requires a new format version (`air 1`) introduced by an RFC. An implementation that supports several format versions selects the semantics by the module's `air` line; it never mixes them.
### 8.8 Types and syntax of the features `ownership` and `arrays`
Feature membership: `local<T>`, `ref<T>`, `mut<T>` and the `from` clause belong to `ownership`; `[T; N]`, `slice<T>`, `slice_mut<T>` and multi-result binding belong to `arrays`. Using them without declaring the feature is `E0006` reason `feature_not_declared`.
| Type | Class | Notes |
|---|---|---|
| `local<T>` | storage | frame storage holding a `T`; only an operand of `local.*` and `borrow.*` |
| `ref<T>` | borrow | shared borrow |
| `mut<T>` | borrow | exclusive borrow |
| `[T; N]` | value | array of `N` values, `1 ≤ N ≤ 2^32`; copyable when `T` is |
| `slice<T>` | borrow | shared borrow of a contiguous range |
| `slice_mut<T>` | borrow | exclusive borrow of a contiguous range |
`T` in these types is a value type: not `void`, `never`, a storage type or a borrow type.
**Second-class rule.** Storage and borrow types MUST NOT appear as struct fields, enum payloads, array elements or the `T` of another storage or borrow type (`E1001`). A storage type MUST NOT appear as a function parameter, return type or block parameter (`E1001`). A borrow type MAY appear as a function parameter and, with `from`, as a return type (spec 08 §11.3). As a block parameter type it requires the reserved feature `borrow_joins` (spec 08 §11.6).
All value types of format 0 and Phase 1 are copyable. Move-only values arrive with `heap` in Phase 2.
Syntax additions (reference/air-text.ebnf): `-> type from %param` on function signatures, the type forms above, and `%a, %b = op` for instructions specified with two results (only `slice.split`).