wip(0.S2): migrate - a var nothing writes becomes a let; a state is keyed by its module, directory or program, so every program's plan agrees; paths normalized; program states named SceneDemoState / scene_demo_st; the LSP reads state, mut and entry/handler parameters
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3eda72e8c2
commit
5ffe50ed02
463 changed files with 72045 additions and 67421 deletions
|
|
@ -4,19 +4,17 @@ property Catch {
|
|||
fish: int = 0
|
||||
}
|
||||
event Landed { fish: int }
|
||||
export state FishingState {
|
||||
landed: int = 0
|
||||
last: Catch = null
|
||||
}
|
||||
@On(Landed) handler Count(fishing_st: mut FishingState) { fishing_st.landed += fish }
|
||||
var landed: int = 0
|
||||
var last: Catch = null
|
||||
@On(Landed) handler Count { landed += fish }
|
||||
function catch_new(n: int) -> Catch {
|
||||
let c = new Catch
|
||||
c.fish = n
|
||||
return c
|
||||
}
|
||||
export function fishing_day(fishing_st: mut FishingState) -> int {
|
||||
fishing_st.last = catch_new(3)
|
||||
emit Landed(fish: fishing_st.last.fish)
|
||||
export function fishing_day() -> int {
|
||||
last = catch_new(3)
|
||||
emit Landed(fish: last.fish)
|
||||
emit Landed(fish: 4)
|
||||
return fishing_st.landed
|
||||
return landed
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue