wip(0.S3): ui blocks, scene on enter/exit, hooks, machines over a state's field, namespace and engine-system injection; a reference out of a read-only state or a module let is read-only; deps counts writes into another module's state; the rejected examples hold states
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
4919c9c2fc
commit
e7f8ee6b91
31 changed files with 100137 additions and 72476 deletions
|
|
@ -1,13 +1,15 @@
|
|||
# bank/ledger.ludic - inherits `module bank` from the barrel that imports it
|
||||
var balance: int = 0
|
||||
export event Deposited { amount: int }
|
||||
function add(n: int) -> void {
|
||||
balance += n
|
||||
export state BankState {
|
||||
balance: int = 0
|
||||
}
|
||||
export function deposit(n: int) -> void {
|
||||
add(n)
|
||||
export event Deposited { amount: int }
|
||||
function add(bank_st: mut BankState, n: int) -> void {
|
||||
bank_st.balance += n
|
||||
}
|
||||
export function deposit(bank_st: mut BankState, n: int) -> void {
|
||||
add(bank_st, n)
|
||||
emit Deposited(amount: n)
|
||||
}
|
||||
export function total() -> int {
|
||||
return balance
|
||||
export function total(bank_st: BankState) -> int {
|
||||
return bank_st.balance
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue