Step 5.5 phases 1-2: merge sx_scope into sx_primitives, 4-child define support

Phase 1: Absorb sx_scope.ml (180 lines) into sx_primitives.ml. Scope stacks,
cookies, and trace infrastructure now live alongside other primitives. All 20
scope primitive registrations moved. References updated in sx_server.ml and
sx_browser.ml. sx_scope.ml deleted.

Phase 2: Transpiler handles (define name :effects (...) (fn ...)) forms.
ml-emit-define and ml-emit-define-body detect keyword at position 2 and use
(last expr) instead. Unblocks transpilation of spec/render.sx and
web/adapter-html.sx which use 4-child defines extensively.

2598/2598 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 19:43:26 +00:00
parent 1dd4c87d64
commit 19e7a6ee2d
5 changed files with 189 additions and 195 deletions

View File

@@ -1712,7 +1712,8 @@
(expr)
(let
((name (if (= (type-of (nth expr 1)) "symbol") (symbol-name (nth expr 1)) (str (nth expr 1))))
(val-expr (nth expr 2)))
(val-expr
(let ((raw (nth expr 2))) (if (keyword? raw) (last expr) raw))))
(let
((ml-name (ml-mangle name))
(is-fn
@@ -1825,7 +1826,8 @@
(expr)
(let
((name (if (= (type-of (nth expr 1)) "symbol") (symbol-name (nth expr 1)) (str (nth expr 1))))
(val-expr (nth expr 2)))
(val-expr
(let ((raw (nth expr 2))) (if (keyword? raw) (last expr) raw))))
(let
((ml-name (ml-mangle name))
(is-fn