--- id: annot-machine name: @Machine category: annotations kind: annotation tokens: @Machine sig: @Machine(Deer.mood) registry DeerSteps of DeerStep from "deer_steps.lres" tip: A registry of a state machine's transitions over an enum field of a table's rows: the compiler writes its reducers and tick. order: 84 --- @Machine(Record.field) marks a registry as the transitions of a state machine over that enum field of the records a state's Table<Record> holds. The registry's record has from and to (the enum's variants), on (an action's name, or "" for a transition the tick asks), and a guard and an enter taking the row first. The start is the field's default. The compiler writes a row reducer for each action an on names and, for the guard-only transitions, <registry>_tick; each takes the first transition from the row's state whose guard passes, sets the field and runs enter. Nothing else writes the field. A state never reached, a state with no way out, an on naming no action (or one with no @Target), a self-transition with no guard and a second way out behind an unguarded first on one trigger are compile errors. ```ludic # doc-check: skip — a fragment: the record, the table's state and the functions are elsewhere property DeerStep { from: Mood = Mood.Calm to: Mood = Mood.Calm on: string = "" guard: fn(Row, Herd) -> bool = null enter: fn(Row, Herd) -> void = null } @Machine(Deer.mood) registry DeerSteps of DeerStep from "deer_steps.lres" ```