Step 10c: unified reactive model — peek + provide! special forms + tracking primitives
CEK evaluator integration: - peek — non-tracking read from provide frame (like context but never subscribes) - provide! — mutate value in provide frame (cf_extra made mutable) - Both dispatch as special forms alongside provide/context Scope-stack primitives (for adapter/island use): - provide-reactive! / provide-pop-reactive! / provide-set! — signal-backed scope - peek (primitive) — non-tracking scope read - context (override) — tracking-aware scope read - bind — tracked computation with auto-resubscription - tracking-start! / tracking-stop! / tracking-active? — tracking context 12/13 user-authored peek/provide! tests pass. bind integration with CEK context pending (scope vs kont gap). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1506,6 +1506,8 @@
|
||||
("deref" (step-sf-deref args env kont))
|
||||
("scope" (step-sf-scope args env kont))
|
||||
("provide" (step-sf-provide args env kont))
|
||||
("peek" (step-sf-peek args env kont))
|
||||
("provide!" (step-sf-provide! args env kont))
|
||||
("context" (step-sf-context args env kont))
|
||||
("emit!" (step-sf-emit args env kont))
|
||||
("emitted" (step-sf-emitted args env kont))
|
||||
@@ -2708,6 +2710,49 @@
|
||||
env
|
||||
kont))))
|
||||
|
||||
(define
|
||||
step-sf-peek
|
||||
(fn
|
||||
(args env kont)
|
||||
(let
|
||||
((name (trampoline (eval-expr (first args) env)))
|
||||
(default-val
|
||||
(if
|
||||
(>= (len args) 2)
|
||||
(trampoline (eval-expr (nth args 1) env))
|
||||
nil))
|
||||
(frame (kont-find-provide kont name)))
|
||||
(make-cek-value
|
||||
(if
|
||||
frame
|
||||
(get frame "value")
|
||||
(if
|
||||
(env-has? env "peek")
|
||||
(apply (env-get env "peek") (list name default-val))
|
||||
default-val))
|
||||
env
|
||||
kont))))
|
||||
|
||||
(define
|
||||
step-sf-provide!
|
||||
(fn
|
||||
(args env kont)
|
||||
(let
|
||||
((name (trampoline (eval-expr (first args) env)))
|
||||
(new-val (trampoline (eval-expr (nth args 1) env)))
|
||||
(frame (kont-find-provide kont name)))
|
||||
(if
|
||||
frame
|
||||
(do
|
||||
(dict-set! frame "value" new-val)
|
||||
(make-cek-value new-val env kont))
|
||||
(if
|
||||
(env-has? env "provide-set!")
|
||||
(do
|
||||
(apply (env-get env "provide-set!") (list name new-val))
|
||||
(make-cek-value new-val env kont))
|
||||
(make-cek-value nil env kont))))))
|
||||
|
||||
(define
|
||||
step-sf-emit
|
||||
(fn
|
||||
|
||||
Reference in New Issue
Block a user