feat(lang): open registry - other modules' defs, in an order imports cannot change
A def from another module into a registry that is not open is refused, and defs go through visibility (the registry exported, its module in the definer's uses). Index order: the declaring module's entries, then the other modules' by module name, each in reading order. A registry entry is emitted as its own file's code, so what it names is seen from its own module. Reseed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
05b09b4c98
commit
6cfaaf0bf9
19 changed files with 49801 additions and 47689 deletions
|
|
@ -24,6 +24,7 @@ function selfhost_frags() -> []pointer {
|
|||
push(f, "selfhost/frontend/ports.ludic")
|
||||
push(f, "selfhost/frontend/registry.ludic")
|
||||
push(f, "selfhost/frontend/registry_finish.ludic")
|
||||
push(f, "selfhost/frontend/registry_open.ludic")
|
||||
push(f, "selfhost/frontend/resource.ludic")
|
||||
push(f, "selfhost/frontend/defaults.ludic")
|
||||
push(f, "selfhost/frontend/view.ludic")
|
||||
|
|
|
|||
|
|
@ -765,6 +765,9 @@ function cmd_dev_test() -> int {
|
|||
reject_case("rejected/registry_unknown", "there is no registry Tables", "a def names a registry that exists")
|
||||
reject_case("rejected/registry_twice", "def Furnishings crate is declared twice", "a registry's key is declared once")
|
||||
reject_case("rejected/registry_field", "Furnishing has no field colour", "a def's fields are the record's")
|
||||
feat_case("modules/open_registry", "", "clock animals weather / 2 2 3", "open_registry.ludic (L8+L3: an open registry takes other modules' defs; its own entries first, then by module name)")
|
||||
reject_case("rejected/registry_closed", "registry Tools is not open to other modules", "a def from another module into a registry that is not open is refused")
|
||||
reject_case("rejected/registry_hidden", "Tools is private to module kit", "a def goes through visibility: the registry must be exported")
|
||||
feat_case("lang/resources", "", "2 Axe 2 Split 10 0 1", "resources.ludic (L9: a registry read from a resource file at compile time, nested records typed by the schema)")
|
||||
reject_case("rejected/resource_field", "bad_tools.lres:3: error: field weight of Tool wants a float", "a resource file's entry is checked at its own line")
|
||||
reject_case("rejected/resource_missing", "cannot read the resource file data/no_such.lres", "a registry's resource file must exist")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue