Extend `enum` from named int constants to a tagged union: a variant may
carry a payload (`enum Tile { Empty, Wall, Door(int), Portal(int, int) }`).
Such enums box to a heap record (an i32 tag at offset 0, then one 8-byte
slot per payload position); an all-bare enum keeps its zero-cost compile-
time-ordinal representation, byte-for-byte unchanged (every golden render
and the bootstrap fixpoint still hold).
- Parser: variant payload declarations, stored as N_PARAM kids on the
variant node.
- Construction: by name — `Door(3)`, `Portal(x, y)`, bare `Empty` — resolved
ahead of the function-call fallback and boxed with the payloads coerced to
their declared types.
- match: destructures a tagged scrutinee, switching on the tag and binding
each arm's payload names in a scoped local frame.
- Checking pass: a tagged `match` must be exhaustive (cover every variant or
end in `_`), and constructor/pattern arities and binding forms are checked
— all reported where the scrutinee's type is known.
Adds selfhost/tests/enums.ludic to the regression suite and documents the
feature in LANGUAGE.md and the enum/match pages.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| anim-ergonomics.md | ||
| audio-namespace.md | ||
| coverage.md | ||
| engine-systems.md | ||
| error-handling.md | ||
| fix-fixed-const-type.md | ||
| http-namespace.md | ||
| input-actions.md | ||
| input-device-layer.md | ||
| input-hardware-bindings.md | ||
| light-ecs-components.md | ||
| light-namespace.md | ||
| light-tiers.md | ||
| README.md | ||
| recover.md | ||
| tagged-union-enums.md | ||
| testing-framework.md | ||
| types-2d-ivec-rect.md | ||
| types-bignum-decimal.md | ||
| types-containers.md | ||
| types-huge-angle-percent.md | ||
| types-option.md | ||
| value-tree.md | ||
Changesets
A changeset is one small Markdown file describing a single user-facing change,
dropped in this directory. x release consumes every changeset here into a new
CHANGELOG.md section, bumps VERSION, and deletes the consumed files.
Format
bump: minor
type: feat
One or more lines describing the change, in the past-agnostic imperative used in
the changelog. Markdown is fine.
bump:—major,minor, orpatch(SemVer). The release version is bumped by the highest level among the pending changesets (unlessx release <level>overrides it).type:— the Conventional Commit type (feat,fix,perf,docs, …); it becomes the bold prefix of the changelog bullet.
Adding one
Create a file with a short, unique name, e.g. changes/regex-namespace.md. Any
filename works except this README.md, which the release step always skips.