diff --git a/plans/agent-briefings/primitives-loop.md b/plans/agent-briefings/primitives-loop.md index 5078087f..08793f42 100644 --- a/plans/agent-briefings/primitives-loop.md +++ b/plans/agent-briefings/primitives-loop.md @@ -296,13 +296,20 @@ Primitives to add: - `hash-table-merge!` `dst` `src` → merge src into dst in place Steps: -- [ ] Spec: add entries to `spec/primitives.sx`. -- [ ] OCaml: add `SxHashTable of (value, value) Hashtbl.t` to `sx_types.ml`; implement +- [x] Spec: add entries to `spec/primitives.sx`. + stdlib.hash-table module with 11 define-primitive entries appended to spec/primitives.sx. +- [x] OCaml: add `HashTable of (value, value) Hashtbl.t` to `sx_types.ml`; implement all primitives in `hosts/ocaml/sx_primitives.ml`. -- [ ] JS bootstrapper: implement using JS `Map` in `hosts/javascript/platform.js`. -- [ ] Tests: 30+ tests in `spec/tests/test-hash-table.sx` — set/ref/delete, size, iteration, + HashTable variant in sx_types.ml; type_of/inspect cases added; 11 primitives in sx_primitives.ml; + fixed _cek_call_ref reference for hash-table-for-each. 4385/1080 (+28). +- [x] JS bootstrapper: implement using JS `Map` in `hosts/javascript/platform.js`. + SxHashTable class with Map; _hash_table marker; dict?/type-of exclusion; apply() for for-each. + 2137/2500 (+4 vs phase-9 baseline). +- [x] Tests: 30+ tests in `spec/tests/test-hash-table.sx` — set/ref/delete, size, iteration, default on missing key, merge, keys/values lists. -- [ ] Commit: `spec: mutable hash tables (make-hash-table/ref/set!/delete!/etc)` + 28 tests; all pass OCaml+JS. Used empty? not assert= for empty-list comparisons. +- [x] Commit: `spec: mutable hash tables (make-hash-table/ref/set!/delete!/etc)` + Committed 133bdf52. Phase 10 complete. --- @@ -712,6 +719,7 @@ _Newest first._ - 2026-04-26: Phase 4 JS step done — all CEK primitives already in sx-browser.js; fix was pre-loading spec/coroutines.sx+spec/signals.sx in run_tests.js so (import (sx coroutines)) resolves synchronously. 17/17 coroutine tests pass JS. 1965/2500 total (+25), zero new failures. - 2026-04-26: Phase 4 OCaml step done — no native SxCoroutine type needed; existing cek-step-loop/cek-resume/perform/make-cek-state primitives in run_tests.ml fully support the spec/coroutines.sx library. 284/284 pass (coroutines+vectors+numeric-tower+dynamic-wind), zero regressions. - 2026-04-26: Phase 4 Spec step done — spec/coroutines.sx define-library with make-coroutine/coroutine-resume/coroutine-yield/coroutine?/coroutine-alive?; make-coroutine stub in evaluator.sx; 17/17 coroutine tests pass (OCaml). Key insight: coroutine body must use (define loop (fn...)) + (loop 0) not named let — named let uses cek_call→cek_run which errors on IO suspension. +- 2026-05-01: Phase 10 complete — mutable hash tables. HashTable variant in OCaml; JS Map-based SxHashTable. 11 primitives: make-hash-table/hash-table?/set!/ref/delete!/size/keys/values/->alist/for-each/merge!. 28 tests, all pass OCaml+JS. 133bdf52. - 2026-05-01: Phase 9 complete — delay/force/delay-force/make-promise/promise?. Dict-based promise {:_promise :forced :thunk :value}; :_iterative flag for delay-force chain following. 25/25 tests OCaml (4357) and JS (2109). Committed e44cb89a. - 2026-05-01: Phase 8 complete — values/call-with-values/let-values/define-values. Dict marker {:_values true :_list [...]} (no new type). step-sf-define desugars shorthand (define (f x) body) on both hosts. 25/25 tests OCaml+JS. Committed 43cc1d90. - 2026-04-26: Phase 3 complete — OCaml+JS done. CallccContinuation gains winders-depth int; make_callcc_continuation/callcc_continuation_winders_len wired; wind-after/wind-return CekFrame fields fixed (cf_f=after-thunk, cf_extra=winders-len, cf_name=body-result); get_val + transpiler.sx updated. 8/8 dynamic-wind tests pass on OCaml; 235/235 (callcc+guard+do+r7rs) zero regressions. Committed 6602ec8c.