# port_vars.ludic — L3: a port member that takes nothing can be bound to a variable, `money: g_money` # - the compiler writes the getter (bind_Purse_money) in the bind's own file - and a member that takes # something is still bound to a function. # # Running it prints: 40 45 12 program PortVars { port Purse { money: fn() -> int price: fn(int) -> int } state PortVarsState { g_money: int = 40 } let g_rate: int = 3 function priced(n: int) -> int { return n * g_rate } bind Purse { money: PortVarsState.g_money, price: fn priced } entry (port_vars_st: mut PortVarsState) { let a = Purse.money() port_vars_st.g_money += 5 print(`{a} {Purse.money()} {Purse.price(4)}`) } }