feat(lang): 0.R5 - a reducer writes one state and may read others, declared between its state and the action

What only becomes known inside the drain - a value another reducer just set, the map in play - no longer
has to be faked into the action, so a verb that reads several systems while it changes one is a reducer
instead of an act handed its states. A second state to write is still refused, and the message says the
way out. examples/actions/reads.ludic; reseeded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-26 18:23:48 +03:00
parent dfcc851d2a
commit c64f8750e2
8 changed files with 48037 additions and 47917 deletions

View file

@ -1,8 +1,8 @@
# 0.R: a reducer takes its own state and the action; what else it needs rides in the action
# 0.R: a reducer writes its own state and may read others; a second state to write is refused
program ReducerTwoStates {
state Pack { n: int = 0 }
state Wallet { cash: int = 0 }
action Buy { cost: int }
reducer Pack on Buy(p: mut Pack, w: mut Wallet) { p.n += 1 }
reducer Pack on Buy(p: mut Pack, w: mut Wallet, a: Buy) { p.n += 1 }
entry { print(1) }
}