feat(types): Dict + Set string-keyed containers (#54)
Types phase 4 — containers. A splice-on-demand open-addressing hash table (runtime/native/dict.ludic, FNV-1a, linear probing, tombstones, grow at 0.7) behind two namespaces: - Dict.* — string -> int map: new/set/get/get_or/has/remove/size/clear/keys. Resource counts, id/name registries. O(1) average vs a linear list scan. - Set.* — set of strings: new/add/has/remove/size/clear/members. Tags, unlocked achievements, visited tiles. Shares the same table. Values are int (also an entity handle / small id); Value.* covers richer maps. [T; N] inline fixed arrays remain future work — typed buffers and []T slices already cover heap-backed arrays. Wired: parser splice trigger (g_uses_dict), emit_call dispatch, reseeded seed, a self-asserting example (examples/library/containers.ludic + feat_case), and per-symbol docs + inventory. All suites green incl. golden renders byte- identical and the bootstrap fixpoint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
bd6b12d2ea
commit
539f258d92
26 changed files with 22484 additions and 20936 deletions
13
changes/types-containers.md
Normal file
13
changes/types-containers.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
bump: minor
|
||||
type: feat
|
||||
**Containers — `Dict` + `Set` (#54, types phase 4).** Everyday string-keyed
|
||||
lookups backed by one open-addressing hash table (FNV-1a, linear probing,
|
||||
tombstone deletes, grows at load factor 0.7), spliced in on demand.
|
||||
`Dict.*` maps string keys to `int` values — `new`/`set`/`get`/`get_or`/`has`/
|
||||
`remove`/`size`/`clear`/`keys` — for resource counts and id/name registries.
|
||||
`Set.*` is a set of string members — `new`/`add`/`has`/`remove`/`size`/`clear`/
|
||||
`members` — for tags, unlocked achievements and visited tiles. O(1) average
|
||||
lookup instead of a linear list scan. Values are `int` (also holds an `entity`
|
||||
or any small id); the `Value.*` tree already covers richer/heterogeneous maps,
|
||||
and `[T; N]` inline fixed arrays remain future work (typed buffers `words` /
|
||||
`fixeds` / `pointers` and `[]T` slices cover heap-backed arrays today).
|
||||
Loading…
Add table
Add a link
Reference in a new issue