spec: accept RFC 0009 and integrate unsafe boundaries

- spec 13 §6-§8: unsafe operations (assume, borrow.index.unchecked),
  contagious unsafe effect, trusted boundary with obligation, E6001,
  unsafe report, profiles as policy
- spec 05 §9.3: trusted is the one discharging boundary; spec 07 §8.10
  trusted syntax; 07a, 08 stage order and assume facts
- T0009, E6001 reasons; feature unsafe published
This commit is contained in:
dev committed 2026-10-04 14:38:53 +03:00
1 parent 17ddb98597
commit c510a37cf9
9 files changed
+105 -7

No files matched your search

+9
View File
@@ -246,6 +246,15 @@ Instructions, budget accounting and verifier rules: spec 03 §18–§20. Summary
`borrow.ref`/`borrow.mut` accept owners and regions as roots: `own<T>` gives `ref<T>`/`mut<T>`, `own_array<T>` gives `slice<T>`/`slice_mut<T>`, `region` gives `ref<region>`/`mut<region>`.
## Feature `unsafe`
| Instruction | Operands → result | Precondition | Reference interpreter |
|---|---|---|---|
| `assume %c` | `bool` | `%c` is true; establishes a fact like `guard` (spec 08 §12) | traps `T0009` if false |
| `%e = borrow.index.unchecked %b, %i` | as `borrow.index` | `%i <` length of `%b` | traps `T0009` if violated |
Allowed only in functions that declare the effect `unsafe` or are `trusted` (`E6001`, spec 13 §6.4).
## Run result
`aji run` executes the function `@main`, whose parameters MUST all be capabilities, bound by name at instantiation (spec 05 §10.2); without the `capabilities` feature it takes no parameters. On return it reports `{"status":"returned","value":V}` where `V` renders the returned value as JSON: