W-ENGINE-INITIAL-MISSING
initial=
attribute omitted on a non-derived
<engine>.
Compiler defaults to the first state-child's variant.
What it means
An
<engine>
must commit to a starting variant. Per §51.0.E, the
initial=
attribute is REQUIRED on every non-derived engine. When omitted,
the compiler will not refuse compilation — it falls back
to the first state-child's variant declaration order —
but emits W-ENGINE-INITIAL-MISSING to surface the implicit
commitment.
Adopters using the prototyping shape (rapid sketch where state
order in the source IS the intended initial) get a working
engine. Adopters who care about explicit authoring intent get
a nudge to declare
initial=.Variant.
Minimal reproducer
type Phase:enum = { Idle, Loading, Done }
<engine for=Phase>
// ^^^^^^^^^
// W-ENGINE-INITIAL-MISSING: initial= absent.
// Defaults to .Idle (first state-child).
<Idle rule=.Loading />
<Loading rule=.Done />
<Done rule=.Idle />
</>
How to fix
-
Add
initial=.Variant— the canonical form. Makes the starting variant explicit, survives state-child reordering without behavior change, and silences the warning. -
Suppress the warning per SPEC §28 lint
suppression configs if the prototype shape is intentional.
Config:
lint.engine-initial-missing. Use sparingly; explicitinitial=is preferred for production code.
Derived engines: initial= is FORBIDDEN
Derived engines (per §51.0.J,
<engine for=Type derived=expr>)
reject
initial=
entirely — the starting variant is whatever
expr
evaluates to at module-init time, NOT an authored value.
Providing
initial=
on a derived engine fires
E-DERIVED-ENGINE-NO-INITIAL
(error, not warning).
Related
- <engine> — element reference.
- E-DERIVED-ENGINE-NO-INITIAL — error for the opposite case (initial= on derived engine).
Specification
Normative text: SPEC §51.0.E (initial= required on non-derived engines + first-state-child fallback rule), §51.0.J (derived engines reject initial=), §28 (lint suppression configs), §34 catalog row. Spec lives at compiler/SPEC.md .