Step 10c: batch coalescing + global subscriber registry

Provide subscribers stored in global *provide-subscribers* dict (keyed
by name) instead of on provide frames. Fixes subscriber loss when
frames are reconstructed, and enables cross-cek_run notification.

Batch integration: batch-begin!/batch-end! primitives manage
*provide-batch-depth*. fire-provide-subscribers defers to queue when
depth > 0, batch-end! flushes deduped. signals.sx batch calls both.

context now prefers scope-peek over frame value — scope stack is the
source of truth since provide! always updates it (even in nested
cek_run where provide frames aren't on the kont).

2754/2768 OCaml (14 pre-existing). 32/32 WASM.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 11:39:38 +00:00
parent 44b520a9e9
commit fb262aa49b
7 changed files with 1457 additions and 1341 deletions

View File

@@ -149,8 +149,9 @@
batch
:effects (mutation)
(fn
((thunk :as lambda))
((thunk :as callable))
(set! *batch-depth* (+ *batch-depth* 1))
(batch-begin!)
(cek-call thunk nil)
(set! *batch-depth* (- *batch-depth* 1))
(when
@@ -165,14 +166,15 @@
((s :as signal))
(for-each
(fn
((sub :as lambda))
((sub :as callable))
(when
(not (contains? seen sub))
(append! seen sub)
(append! pending sub)))
(signal-subscribers s)))
queue)
(for-each (fn ((sub :as lambda)) (sub)) pending))))))
(for-each (fn ((sub :as callable)) (sub)) pending))))
(batch-end!)))
(define
notify-subscribers
:effects (mutation)