diff --git a/plans/agent-briefings/primitives-loop.md b/plans/agent-briefings/primitives-loop.md index 47b47f6b..a3fb1a15 100644 --- a/plans/agent-briefings/primitives-loop.md +++ b/plans/agent-briefings/primitives-loop.md @@ -186,7 +186,10 @@ simulate sum types. A native `define-type` + `match` form eliminates this everyw `(match expr ((Ctor1 a b) body) ((Ctor2 x) body) (else body))` Exhaustiveness warning if not all constructors covered and no `else`. -- [ ] OCaml: add `SxAdt of string * value array` to types; implement constructors + match. +- [x] OCaml: add `SxAdt of string * value array` to types; implement constructors + match. + Dict-based ADT (no native type needed — matches spec). Hand-written sf_define_type + in bootstrap.py FIXUPS; registered via register_special_form. 172 assertions pass. + 4280/1080 full suite (37 improvement over old baseline 4243/1117). - [ ] JS bootstrapper: update. - [ ] Tests: 40+ tests in `spec/tests/test-adt.sx`. - [ ] Commit: `spec: algebraic data types (define-type + match)` @@ -686,6 +689,7 @@ Brief each language's loop agent (or do inline) after rebasing their branch onto _Newest first._ +- 2026-04-26: Phase 6 OCaml done — Dict-based ADT (no native SxAdt type needed); hand-written sf_define_type in bootstrap.py FIXUPS (skipped from transpile — &rest params + empty-dict {} literals); registered via register_special_form; step_limit/step_count added to PREAMBLE. 172 assertions pass (test-adt). Full suite 4280/1080 (was 4243/1117, +37). Committed 5d1913e7. - 2026-04-26: Phase 6 Spec match done — ADT case added to match-pattern in spec/evaluator.sx: checks (list? pattern)+(symbol? first)+(dict? value)+(get value :_adt), then matches :_ctor+arity and recursively binds field patterns. No-clause error now uses make-cek-value+raise-eval-frame so guard can catch it. 20 new match tests pass; 40/40 total ADT tests green. Zero regressions. - 2026-04-26: Phase 6 Spec define-type done — sf-define-type registered via register-special-form! in spec/evaluator.sx; AdtValue as {:_adt true :_type "..." :_ctor "..." :_fields (list ...)}; ctor fns + arity checking + Name?/Ctor? predicates + Ctor-field accessors; *adt-registry* dict populated per define-type call. 20/20 JS tests pass in spec/tests/test-adt.sx. OCaml define-type is next task. - 2026-04-26: Phase 6 Design done — plans/designs/sx-adt.md written. Covers define-type/match syntax, AdtValue CEK runtime, stepSfDefineType+MatchFrame dispatch, exhaustiveness warnings, recursive types, nested patterns, wildcard _. 3-phase impl plan. Next fire: Spec implement define-type.