rfc: define rooted module state and source contract elaboration
This commit is contained in:
1 parent
8260d3521e
commit
03614c9bef
6 files changed
+120
-4
No files matched your search
@@ -18,7 +18,7 @@ The earlier RFC probes also demonstrate invalid Copy publication and shared-read
|
||||
|
||||
## Leading type candidate: checked representation plus explicit update
|
||||
|
||||
Investigate `checked<R, @predicate>` in AIR, source `checked<R, fn predicate>`. Identity is structural over representation and resolved function identity. The predicate takes exactly `ref<R>`, returns bool, and has no captures or implicit roots. Source uses existing explicit function resolution/specialization rules; a new nominal naming declaration is a separate choice, not an assumed alias feature. A generic representation is checked after concrete substitution.
|
||||
Investigate `checked<R, @predicate>` in AIR, source `type.checked<R, fn predicate>` under the [module/source refinement](contract-source-and-module-state.md). The reserved type prefix avoids hijacking user modules/types named checked. Identity is structural over representation and resolved function identity. The predicate takes exactly `ref<R>`, returns bool, and has no captures or implicit roots. Source uses existing explicit function resolution/specialization rules; the refinement proposes a narrow checked-type binding, not a general alias facility. A generic representation is checked after concrete substitution.
|
||||
|
||||
The claim is: every exposed checked value/shared content view satisfies its predicate. An explicit update temporarily exposes ordinary R under exclusive access; R carries no such claim. Whole checked values retain R's Copy/linear, size and structural concurrency classifications, subject to a complete property audit. Copies and transfers need no additional check. The representation is initialized as a complete value, and checked types have no zero constructor even when R is zeroable.
|
||||
|
||||
@@ -39,7 +39,7 @@ The callback can perform ordinary multi-field updates and use disjoint fields in
|
||||
|
||||
Successful callback completion is not yet successful update completion. Predicate false, callback/predicate traps or fuel exhaustion publish no checked result. Failure traps with no rollback of state or external effects. Pending borrow-free results, including linear ones, must be retained and traced until validation finishes. Candidate fuel accounting is one unit for the make/modify operation, then ordinary helper instructions, with no synthetic callback-to-predicate instruction. Callback and predicate use normal call frames, sequentially; the callback frame ends before the predicate starts. Exact dispatch, temporary-view and trap rules still require RFC integration and tests. Checking after a callback must use a legal shared view after its exclusive loan has ended, not privileged access through a frozen ancestor.
|
||||
|
||||
Candidate source surface is an explicit function-based API: a shared `ref raw = checked.view(parent)` binding, whole-value `checked.make`/`checked.take`, and `checked.modify(parent, fn update, args...)` on a named exclusive binding. Callback specialization uses existing static function identity, not a runtime function value. Exact make/type grammar, source diagnostics and any later scoped block form remain decisions. A block form must specify captures and effects before adoption.
|
||||
Candidate source surface is an explicit API under type.checked: a shared `ref raw = type.checked.view(parent)` binding, `type.checked.make::<R, fn p>`/`type.checked.take`, and `type.checked.modify::<fn update>(parent, args...)` on a named exclusive binding. Callback specialization uses existing static function identity, not a runtime function value. The module/source refinement gives grammar and clause-root rules; diagnostics and any later scoped block form still need integration. A block form must specify captures and effects before adoption.
|
||||
|
||||
## Stability is stronger than purity
|
||||
|
||||
|
||||
Reference in new issue
Block a user