Replace invoke with cek-call in adapters and engine

Completes the invoke→cek-call migration across all spec .sx files:
- adapter-sx.sx: map/filter/for-each in aser wire format
- adapter-dom.sx: island render update-fn
- engine.sx: fetch transform callback
- test-cek-reactive.sx: disposal test

Only async-invoke (adapter-async.sx) remains — separate async pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-14 10:16:47 +00:00
parent 455e48df07
commit 6581211a10
6 changed files with 15 additions and 15 deletions

View File

@@ -1146,7 +1146,7 @@
(let ((initial (cek-run
(make-cek-state expr env
(list (make-reactive-reset-frame env update-fn true))))))
(invoke update-fn initial)))))
(cek-call update-fn (list initial))))))
;; --------------------------------------------------------------------------

View File

@@ -291,7 +291,7 @@
(let ((local (env-merge (lambda-closure f) env)))
(env-set! local (first (lambda-params f)) item)
(aser (lambda-body f) local))
(invoke f item)))
(cek-call f (list item))))
coll))
;; map-indexed
@@ -304,7 +304,7 @@
(env-set! local (first (lambda-params f)) i)
(env-set! local (nth (lambda-params f) 1) item)
(aser (lambda-body f) local))
(invoke f i item)))
(cek-call f (list i item))))
coll))
;; for-each — evaluate for side effects, aser each body
@@ -317,7 +317,7 @@
(let ((local (env-merge (lambda-closure f) env)))
(env-set! local (first (lambda-params f)) item)
(append! results (aser (lambda-body f) local)))
(invoke f item)))
(cek-call f (list item))))
coll)
(if (empty? results) nil results))

View File

@@ -530,7 +530,7 @@
(if (and env new-html (not (empty? new-html)))
;; Parse new content as SX and re-evaluate in island scope
(let ((parsed (parse new-html)))
(let ((sx-content (if transform (invoke transform parsed) parsed)))
(let ((sx-content (if transform (cek-call transform (list parsed)) parsed)))
;; Dispose old reactive bindings in this marsh
(dispose-marsh-scope old-marsh)
;; Evaluate the SX in a new marsh scope — creates new reactive bindings

View File

@@ -2893,11 +2893,11 @@ def aser_special(name, expr, env):
elif sx_truthy((name == 'map')):
f = trampoline(eval_expr(first(args), env))
coll = trampoline(eval_expr(nth(args, 1), env))
return map(lambda item: ((lambda local: _sx_begin(_sx_dict_set(local, first(lambda_params(f)), item), aser(lambda_body(f), local)))(env_merge(lambda_closure(f), env)) if sx_truthy(is_lambda(f)) else invoke(f, item)), coll)
return map(lambda item: ((lambda local: _sx_begin(_sx_dict_set(local, first(lambda_params(f)), item), aser(lambda_body(f), local)))(env_merge(lambda_closure(f), env)) if sx_truthy(is_lambda(f)) else cek_call(f, [item])), coll)
elif sx_truthy((name == 'map-indexed')):
f = trampoline(eval_expr(first(args), env))
coll = trampoline(eval_expr(nth(args, 1), env))
return map_indexed(lambda i, item: ((lambda local: _sx_begin(_sx_dict_set(local, first(lambda_params(f)), i), _sx_dict_set(local, nth(lambda_params(f), 1), item), aser(lambda_body(f), local)))(env_merge(lambda_closure(f), env)) if sx_truthy(is_lambda(f)) else invoke(f, i, item)), coll)
return map_indexed(lambda i, item: ((lambda local: _sx_begin(_sx_dict_set(local, first(lambda_params(f)), i), _sx_dict_set(local, nth(lambda_params(f), 1), item), aser(lambda_body(f), local)))(env_merge(lambda_closure(f), env)) if sx_truthy(is_lambda(f)) else cek_call(f, [i, item])), coll)
elif sx_truthy((name == 'for-each')):
f = trampoline(eval_expr(first(args), env))
coll = trampoline(eval_expr(nth(args, 1), env))
@@ -2908,7 +2908,7 @@ def aser_special(name, expr, env):
local[first(lambda_params(f))] = item
results.append(aser(lambda_body(f), local))
else:
invoke(f, item)
cek_call(f, [item])
if sx_truthy(empty_p(results)):
return NIL
else:

View File

@@ -148,7 +148,7 @@
true)))))
;; Pop scope — call all disposers
(scope-pop! "sx-island-scope")
(for-each (fn (d) (invoke d)) disposers)
(for-each (fn (d) (cek-call d nil)) disposers)
;; Change signal — no update should fire
(reset! s 999)
(assert-equal 0 (len update-calls)))))