feat(lang): a module's private records and events are its own

A property or event a module does not export no longer collides with
another module's of the same spelling: each private one is renamed for
its module, with the types, new, emit and @On written in that module.
Exported ones stay one namespace; two events of one spelling are now
refused. Generic records, entity components and component or view
records stay global. Reseed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 11:02:48 +03:00
parent 029a1ebba2
commit 69352babfd
17 changed files with 50199 additions and 44822 deletions

View file

@ -23,6 +23,7 @@ function selfhost_frags() -> []pointer {
push(f, "selfhost/frontend/modules.ludic")
push(f, "selfhost/frontend/ports.ludic")
push(f, "selfhost/frontend/privates.ludic")
push(f, "selfhost/frontend/privates_types.ludic")
push(f, "selfhost/frontend/registry.ludic")
push(f, "selfhost/frontend/registry_finish.ludic")
push(f, "selfhost/frontend/registry_open.ludic")

View file

@ -821,6 +821,9 @@ function cmd_dev_test() -> int {
reject_case("rejected/uses_package", "mech uses ludic_inventory.inv_count", "a package's module counts under `uses` like any other")
reject_case("rejected/uses_render3d", "mech uses ludic_render3d.PI", "a package with no module line is still named under `uses`")
feat_case("modules/private_twins", "", "105 41 7", "private_twins.ludic (L3: two modules' private seed, dice and LIMIT, and the program's seed, do not collide)")
feat_case("modules/private_kinds", "", "7 hare", "private_kinds.ludic (L3: two modules' private record Catch and event Landed do not collide)")
reject_case("rejected/exported_kinds", "'Catch' is defined twice", "two modules that export one record still clash")
reject_case("rejected/exported_events", "event 'Landed' is defined twice", "two modules that export one event clash")
reject_case("rejected/exported_twins", "function 'seed' is defined twice", "two modules that export one name still clash")
vis_report_case("rejected/uses_missing", "uses: examples/rejected/uses_valley/items/index.ludic:3: items.inv_add used from", "LUDIC_VIS_REPORT=1 lists a uses violation and builds")
feat_case("lang/checked", "", "7.5 3 12 hi 2 ok", "checked.ludic (L4: literals take their slot's kind, string(p), []string as []pointer, null, named args)")