feat(lang): L8 registries by declaration - registry and def
registry NAME of RECORD [as PREFIX] is a global table; def NAME key { ... } in
any file is one entry, collected in source order and filled before any code
runs. Each entry gets an index constant (PREFIX_KEY), the table PREFIX_COUNT,
and a record with a key field gets it filled and a NAME_find(key). A record
literal naming a field its record lacks is now an error everywhere; a global's
initializer is lowered as its own file's code (its errors, and what its module
may see, were whichever statement came last).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b0b0b62bce
commit
7e7f3ab297
15 changed files with 48231 additions and 44362 deletions
8
changes/registries.md
Normal file
8
changes/registries.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
bump: minor
|
||||
type: feature
|
||||
**Registries by declaration.** `registry Furnishings of Furnishing as HF` declares a table of
|
||||
records, and each `def Furnishings chair { name: "Camp chair", cost: 60 }` - in any file - is an
|
||||
entry of it, filled before any code runs. Every entry gets an index constant (`HF_CHAIR`, in
|
||||
declaration order), the table a count (`HF_COUNT`), and a record with a `key` field gets it filled
|
||||
in and a lookup, `furnishings_find(key)`. A def's fields are checked; a record literal naming a field
|
||||
its record does not have is now an error everywhere.
|
||||
Loading…
Add table
Add a link
Reference in a new issue