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:
parent
029a1ebba2
commit
69352babfd
17 changed files with 50199 additions and 44822 deletions
8
examples/rejected/exported_events.ludic
Normal file
8
examples/rejected/exported_events.ludic
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# L3: two modules that both export an event of one name clash
|
||||
import "exported_events/a"
|
||||
import "exported_events/b"
|
||||
program ExportedEvents {
|
||||
entry {
|
||||
print(0)
|
||||
}
|
||||
}
|
||||
3
examples/rejected/exported_events/a/index.ludic
Normal file
3
examples/rejected/exported_events/a/index.ludic
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# a/index.ludic - exports Landed
|
||||
module a
|
||||
export event Landed { fish: int }
|
||||
3
examples/rejected/exported_events/b/index.ludic
Normal file
3
examples/rejected/exported_events/b/index.ludic
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# b/index.ludic - exports Landed too
|
||||
module b
|
||||
export event Landed { name: string }
|
||||
9
examples/rejected/exported_kinds.ludic
Normal file
9
examples/rejected/exported_kinds.ludic
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# L3: two modules that both export a record of one name clash
|
||||
import "exported_kinds/a"
|
||||
import "exported_kinds/b"
|
||||
program ExportedKinds {
|
||||
entry {
|
||||
let c = new Catch
|
||||
print(0)
|
||||
}
|
||||
}
|
||||
5
examples/rejected/exported_kinds/a/index.ludic
Normal file
5
examples/rejected/exported_kinds/a/index.ludic
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# a/index.ludic - exports Catch
|
||||
module a
|
||||
export property Catch {
|
||||
fish: int = 0
|
||||
}
|
||||
5
examples/rejected/exported_kinds/b/index.ludic
Normal file
5
examples/rejected/exported_kinds/b/index.ludic
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# b/index.ludic - exports Catch too: exported records are one namespace
|
||||
module b
|
||||
export property Catch {
|
||||
name: string = ""
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue