A typed machine declares closed catalogs of states and events. Its payload types, initializer and transitions must agree with those catalogs.
machine Loader {
state Idle, Ready(value: int)
event Loaded(value: int), Reset
initial Idle
Idle -> Ready(value) on Loaded(value)
Ready(previous) -> Idle on Reset
}Declare each variant once, give every payload an explicit type and provide
the required payloads when constructing a state or event. Transition patterns
must match the actual catalog and bind each name once. Bindings from the state
and event are visible only in that transition's target, guard and action.
Catalog parameter names describe payloads; they are not lexical bindings.
Payload headers and transition bindings cannot use self, which is the
machine receiver.
Informational after expressions resolve in declaration scope, outside the
transition payload bindings.
The initializer evaluates once per .new(), in the declaration's lexical
scope. It cannot exit a caller's function, loop or local Result boundary.
An explicit closure inside it retains its own control-flow boundaries.
State and event payloads must have proven non-linear types: storage and transition listeners may share them. A transitively linear or unproved payload is rejected rather than copied. Payload defaults, variadic parameters and parameter conventions do not describe a valid catalog.
An algebraic effect required by a transition callback must be represented by
the actual callable capability contract. A callback row that this machine's
send interface cannot transport is rejected; it is never silently erased.
Use the real Loader.State and Loader.Event types when annotating values.
Those namespace names are fixed; authored variants and payload parameters
retain their own source locations.
See the machine reference and the typed example.
A state index, such as Order<.Paid>, must select a state from the actual machine declaration. new_static() creates an owned indexed instance; send() consumes it and erase_state() consumes it to return the ordinary dynamic carrier. An annotation, cast, same-spelled declaration or Any boundary cannot create or erase that ownership. Guarded or refutable transitions return Result with the original machine and event on failure. A supported indexed transition must have a single reachable destination and must not expose or mutate the generated receiver from its callbacks.