Register append! and dict-set! as proper primitives

Previously these mutating operations were internal helpers in the JS
bootstrapper but not declared in primitives.sx or registered in the
Python evaluator. Now properly specced and available in both hosts.

Removes mock injections from cache tests — they use real primitives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 00:21:17 +00:00
parent 60b58fdff7
commit 6772f1141f
5 changed files with 29 additions and 13 deletions

View File

@@ -14,7 +14,7 @@
// =========================================================================
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
var SX_VERSION = "2026-03-07T00:04:07Z";
var SX_VERSION = "2026-03-07T00:20:00Z";
function isNil(x) { return x === NIL || x === null || x === undefined; }
function isSxTruthy(x) { return x !== false && !isNil(x); }
@@ -177,7 +177,8 @@
function envExtend(env) { return merge(env); }
function envMerge(base, overlay) { return merge(base, overlay); }
function dictSet(d, k, v) { d[k] = v; }
function dictSet(d, k, v) { d[k] = v; return v; }
PRIMITIVES["dict-set!"] = dictSet;
function dictGet(d, k) { var v = d[k]; return v !== undefined ? v : NIL; }
// Render-expression detection — lets the evaluator delegate to the active adapter.
@@ -452,6 +453,7 @@
var range = PRIMITIVES["range"];
function zip(a, b) { var r = []; for (var i = 0; i < Math.min(a.length, b.length); i++) r.push([a[i], b[i]]); return r; }
function append_b(arr, x) { arr.push(x); return arr; }
PRIMITIVES["append!"] = append_b;
var apply = function(f, args) { return f.apply(null, args); };
// Additional primitive aliases used by adapter/engine transpiled code