wip(0.S1, 0.S2): state records, mut and read-only state parameters, entry injection, module var refused; ludic migrate state
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
63a1fa1378
commit
1e8b5b0523
35 changed files with 1227 additions and 30 deletions
12
examples/state/port_field.ludic
Normal file
12
examples/state/port_field.ludic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# port_field.ludic — 0.S: a port member bound to a state's field, `money: Wallet.cash` - read
|
||||
# through the Wallet the runtime supplies, so a port needs no wrapper and no global.
|
||||
#
|
||||
# Running it prints: 40
|
||||
program PortField {
|
||||
state Wallet { cash: int = 40 }
|
||||
port Purse { money: fn() -> int }
|
||||
bind Purse { money: Wallet.cash }
|
||||
entry {
|
||||
print(Purse.money())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue