Unify scope mechanism: one world (hashtable stacks everywhere)
Replace continuation-based scope frames with hashtable stacks for all scope operations. The CEK evaluator's scope/provide/context/emit!/emitted now use scope-push!/pop!/peek/emit! primitives (registered in sx_primitives table) instead of walking continuation frames. This eliminates the two-world problem where the aser used hashtable stacks (scope-push!/pop!) but eval-expr used continuation frames (ScopeFrame/ScopeAccFrame). Now both paths share the same mechanism. Benefits: - scope/context works inside eval-expr calls (e.g. (str ... (context x))) - O(1) scope lookup vs O(n) continuation walking - Simpler — no ScopeFrame/ScopeAccFrame/ProvideFrame creation/dispatch - VM-compiled code and CEK code both see the same scope state Also registers scope-push!/pop!/peek/emit!/collect!/collected/ clear-collected! as real primitives (sx_primitives table) so the transpiled evaluator can call them directly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,8 @@
|
||||
"emitted" "sx_emitted"
|
||||
"scope-push!" "scope_push"
|
||||
"scope-pop!" "scope_pop"
|
||||
"scope-peek" "scope_peek"
|
||||
"scope-emit!" "scope_emit"
|
||||
"provide-push!" "provide_push"
|
||||
"provide-pop!" "provide_pop"
|
||||
"sx-serialize" "sx_serialize"
|
||||
|
||||
Reference in New Issue
Block a user