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>
15 lines
448 B
Text
15 lines
448 B
Text
# ports.ludic — L3 ports: module clock needs the time and declares `port Clock`; module app binds
|
|
# it with its own function; clock calls through `Clock.now()` and never names app. A member with a
|
|
# default (`day`) may be left out of the bind.
|
|
#
|
|
# Running it prints: 30 5
|
|
import "station/units"
|
|
import "station/clock"
|
|
import "station/app"
|
|
program Ports {
|
|
entry {
|
|
let a = Clock.now()
|
|
advance(-25)
|
|
print(`{a} {hour_of_day()}`)
|
|
}
|
|
}
|