ludic/changes/actions.md
Orkuncakilkaya 808c4a6f7a feat(lang): 0.R1 - actions and reducers
action Name { fields } is a typed record; reducer State on Action(s: mut State, a: Action) { ... }
in the module that owns the state takes exactly that state and the action (a second state is
refused); dispatch Action { fields } queues one from anywhere, the queue supplied by the runtime.
The queue is drained at the end of every phase of the frame loop, after every phase of ludic.base's
core_tick_all, and by drain_actions(): in dispatch order, each action's reducers in the order of
their states' names, an action a reducer dispatches queued behind, a queue still growing after 64
rounds stopped with the action named. Examples actions/pack, phases, runaway; rejects for a second
state, a reducer on a non-action and an unknown dispatch; ludic.base's actions_test; LANGUAGE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 19:13:46 +03:00

895 B

bump: minor type: feature Actions and reducers. action PickUp { item: int } is a typed record of something that happened; reducer Bag on PickUp(b: mut Bag, a: PickUp) { ... }, in the module that owns the state, says what it means for that one state - a reducer takes exactly its state and the action, and a second state is refused; dispatch PickUp { item: 7 } queues one from anywhere. The queue is drained at the end of every phase of the frame loop, after every phase of ludic.base's core_tick_all, and where a program calls drain_actions(): in dispatch order, each action's reducers in the order of their states' names, an action a reducer dispatches queued behind (a queue still growing after 64 rounds stops the program, naming the action). ludic deps reports widest_function - the most states any function or entry point of the program takes - and --check ratchets it.