feat(lang): ports - port Clock { ... } in a module, bind Clock { ... } in the app
A port is a record of function values a module calls through (Clock.now()) without naming the module that answers. A port used and never bound, a bind missing a required member or naming one the port lacks, and a second bind are refused; the binder must see the port, and what it binds is checked from its own file. Reseed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
d0ad364ad4
commit
b1ccaf08bd
19 changed files with 50439 additions and 47750 deletions
10
examples/modules/station/app/index.ludic
Normal file
10
examples/modules/station/app/index.ludic
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# app/index.ludic - the app puts the program together: it sees the port and fills it
|
||||
module app uses clock
|
||||
bind Clock { now: fn game_hours }
|
||||
var g_hours: int = 30
|
||||
function game_hours() -> int {
|
||||
return g_hours
|
||||
}
|
||||
export function advance(h: int) -> void {
|
||||
g_hours += h
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue