cli: add explicit built-in error values
Add the error_values feature and error.const through specification, AIR, verification, interpretation and source lowering. Error values are Copy data with no allocation, effects or authority. Keep enum.make semantics frozen. Cover all registered tags, feature negotiation, payload/type errors and authority rejection in AIR/source; verify canonical and hosted CLI behavior. Record reference-bundle costs and the map preflight-validation prerequisite.
This commit is contained in:
1 parent
89c63c306b
commit
1eaf968f4f
56 files changed
+823
-4
No files matched your search
@@ -113,3 +113,5 @@ RFC 0024 initialized buffers and safe Vec (cl100k, relative to linear aggregates
|
||||
RFC 0025 safe owning Deque (cl100k, relative to buffer/Vec): Quick Reference 7,667 → 7,747 (+1.0%); other source docs 44,717 → 46,246 (+3.4%); full source excluding AIR 52,384 → 53,993 (+3.1%). library/std.md is 10,961 tokens; AIR remains 175,736 bytes. Eleven generic safe functions reuse buffer/Option/exchange and existing ownership/borrow rules without semantic or verifier-state growth. Full ring invariants and accounting stay on demand; cumulative full-source growth is +58.9%, with the RFC's owner-review justification and no empirical MCC claim.
|
||||
|
||||
RFC 0026 std.hash (cl100k, relative to Deque): Quick Reference 7,747 → 7,806 (+0.8%); other source docs 46,246 → 47,475; full source excluding AIR 53,993 → 55,281 (+2.4%). library/std.md is 12,190 tokens; AIR remains 175,736 bytes. Four pure functions expose exact FNV/CRC continuation with no semantic, verifier or authority growth. Cumulative full-source growth is +62.7%, justified in the RFC for owner review without an empirical MCC claim. The proposed map contract stays outside the bundles.
|
||||
|
||||
RFC 0027 explicit error values (cl100k, relative to hashes): Quick Reference 7,806 → 7,863; other source docs 47,475 → 48,061; full source excluding AIR 55,281 → 55,924 (+1.2%). AIR is 179,282 bytes / 51 sections, and its source-bundle copy is 46,300 tokens. The measurement excludes the developing map contract. Existing variant syntax gains pure built-in error values; no authority, resource or ownership state is added. Cumulative source growth is +64.6%; the RFC records the complexity justification, without claiming MCC improvement.
|
||||
@@ -59,6 +59,7 @@ docs/spec/05-effects-and-capabilities.md :: ## 9. Effects in AIR
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 10. Capabilities in AIR
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 11. Intrinsic calls
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 12. Runtime
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 14. Explicit error values
|
||||
|
||||
# Resources and I/O errors
|
||||
docs/spec/06-resources-and-errors.md :: ## 6. Resources in AIR
|
||||
|
||||
@@ -149,6 +149,8 @@ region.reset(r);
|
||||
|
||||
`err(e)` binds a real value: `match e { alloc_error::budget_exceeded => …, alloc_error::out_of_memory => … }`.
|
||||
|
||||
Built-in errors are Copy data: `let e = alloc_error::budget_exceeded;` constructs a payload-free value without effects, allocation or authority. All registered `alloc_error`, `cap_error` and `io_error` variants work this way (spec 05 §14).
|
||||
|
||||
- **Narrowing:** `cap.narrow.prefix(c, b"/data")` and `cap.narrow.budget(heap, 4096)`, each giving `ok(c2) / err(e)`.
|
||||
- Resource operands (`f`, `s`, `l`, endpoints) are borrowed automatically for an operation; a region is not (bind `ref arena = r;`); data borrows (`mut buf`, `ref bytes`) are always written.
|
||||
- Memory budgets count live bytes, so freeing returns them. In the deterministic profile `mem.alloc` needs a grant with a budget: `--grant heap=mem.alloc:4096`.
|
||||
|
||||
@@ -72,6 +72,7 @@ docs/spec/05-effects-and-capabilities.md :: ## 4. Narrowing
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 5. Capability transfer
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 9. Effects in AIR
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 10. Capabilities in AIR
|
||||
docs/spec/05-effects-and-capabilities.md :: ## 14. Explicit error values
|
||||
docs/reference/effects.md
|
||||
docs/reference/capabilities.md
|
||||
|
||||
|
||||
Reference in new issue
Block a user