feat(lang): module NAME uses A, B - a module reaches only the modules it names
A reference from a module that declares uses into a module it does not name is refused, exported or not, naming the use and the fix. A module with no uses clause keeps the old rule; a package's module is always usable; a friend is not held to it; a cycle in the declared graph is refused; LUDIC_VIS_REPORT=1 lists the violations as uses: lines. Reseed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
dd6a449921
commit
f4533331e7
19 changed files with 53571 additions and 50826 deletions
12
examples/modules/uses.ludic
Normal file
12
examples/modules/uses.ludic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# uses.ludic — L3: `module fishing uses base` names the only modules fishing may reach; the program
|
||||
# itself is in no module, so it may call anything exported. A module with no `uses` line keeps the
|
||||
# old rule, which is how the rule comes into a codebase one module at a time.
|
||||
#
|
||||
# Running it prints: 8 3
|
||||
import "valley/base"
|
||||
import "valley/fishing"
|
||||
program Uses {
|
||||
entry {
|
||||
print(`{cast(3)} {bait()}`)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue