ocaml: phase 3 polymorphic variants (+4 tests, 382 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 46s
Tokenizer recognises backtick followed by an upper ident, emitting a
ctor token identical to a nominal ctor. Parser and evaluator treat
polyvariants as ctors — same tagged-list runtime. So:
`Red -> ("Red")
`Some 42 -> ("Some" 42)
match `Red with | `Red -> 1 | `Green -> 2 | `Blue -> 3
-> 1
`Pair (1,2) -> ("Pair" 1 2) (with tuple-arg flatten)
Proper row types in HM deferred.
This commit is contained in:
@@ -182,7 +182,10 @@ SX CEK evaluator (both JS and OCaml hosts)
|
||||
`(:exception-def NAME [ARG-TYPE-SRC])`. Runtime no-op since
|
||||
raise/match work on tagged ctor values. Built-ins:
|
||||
`Failure`/`Invalid_argument` via `failwith`/`invalid_arg`.
|
||||
- [ ] Polymorphic variants (surface syntax `\`Tag value`; runtime same tagged list).
|
||||
- [x] Polymorphic variants (surface syntax `` `Tag value ``; runtime same
|
||||
tagged list as nominal ctors). Tokenizer recognises backtick + ctor;
|
||||
parser/eval treat them identically to nominal ctors. Type system
|
||||
handling deferred (proper row types).
|
||||
- [ ] Tests in `lib/ocaml/tests/adt.sx` — 40+ tests: ADTs, match, option/result.
|
||||
|
||||
### Phase 4 — Modules + functors
|
||||
@@ -374,6 +377,12 @@ the "mother tongue" closure: OCaml → SX → OCaml. This means:
|
||||
|
||||
_Newest first._
|
||||
|
||||
- 2026-05-08 Phase 3 — polymorphic variants `` `Tag `` (+4 tests, 382
|
||||
total). Tokenizer recognises backtick followed by an upper ident,
|
||||
tokenizing identically to nominal ctors. Parser and evaluator treat
|
||||
them as ctors — same tagged-list runtime. Match patterns `` `Red ``
|
||||
/ `` `Pair (a, b) `` work without any extra wiring. Proper row
|
||||
types in HM deferred.
|
||||
- 2026-05-08 Phase 6 — Float module: sqrt/sin/cos/pow/floor/ceil/round
|
||||
+ pi constant (+6 tests, 378 total). Wraps host SX math primitives
|
||||
via `_float_*` builtins.
|
||||
|
||||
Reference in New Issue
Block a user