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:
Orkun ÇAKILKAYA 2026-09-25 15:31:34 +03:00
parent 3eda72e8c2
commit 5ffe50ed02
463 changed files with 72045 additions and 67421 deletions

View file

@ -3,16 +3,14 @@
# `Damage` has two @On listeners: one prints the amount, one accumulates a total.
# Emitting it twice runs both listeners each time. Prints 10 / 32 / 42.
program ModEvents {
state ModeventsState {
total: int = 0
}
var total: int = 0
event Damage { amount: int = 0 }
@On(Damage) handler Native { print(amount) } # prints each hit
@On(Damage) handler Accum(modevents_st: mut ModeventsState) { modevents_st.total += amount } # sums them
@On(Damage) handler Accum { total += amount } # sums them
entry (modevents_st: ModeventsState) {
entry {
emit Damage(amount: 10) # Native prints 10
emit Damage(amount: 32) # Native prints 32
print(modevents_st.total) # 42
print(total) # 42
}
}