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

+5 -3
View File
@@ -58,6 +58,8 @@ Conceptually:
fn first<'a, T>(values: slice<'a, T>) -> Option<ref<'a, T>>
```
In AIR, borrows are second-class (spec 07 §8.8): they live only in SSA values and call arguments, never in aggregates, and a function returns a borrow only with an explicit `from %param` naming the borrow parameter it derives from (spec 08 §11.3). Every borrow created in a function is ended explicitly on every normal path (`borrow.end`). Source-level lifetimes lower to this form; source programs that need more are rejected by the frontend.
## 5. Provenance
Every safe reference has logical provenance including:
@@ -78,6 +80,8 @@ Normal locals live in the current activation frame.
Their references cannot escape the frame unless the language proves that the target execution context completes before the frame ends, as with structured child tasks.
In AIR, frame storage is `local.alloc`, permitted only in a function's entry block so the frame size is known before execution and bounded (spec 08 §11.5). A borrow derived from frame storage never leaves its call (`E2108`, spec 08 §11.3).
## 7. Own<T>
`Own<T>` is a move-only handle to an individually allocated object.
@@ -123,9 +127,7 @@ region.destroy(move r);
A reset logically increments the region generation.
Any borrow or reference associated with a prior generation becomes invalid.
Optimized builds may remove generation checks when statically proven unnecessary.
Any borrow or reference associated with a prior generation becomes invalid. Generations are checked statically only: a region cannot be reset or destroyed while a borrow derived from it is live, and use of a borrow from a prior generation is rejected (`E2104`). Safe code performs no runtime generation checks. Cyclic or arena-style graphs use `Island<T>` or indices (§14). (Decision Q-010; specified with the `regions` feature in Phase 2.)
### 8.2 Reset precondition