✓
Passing This code compiles and runs correctly.
Code
// Prototype mode, the OTHER direction: a continuation may handle a branch the
// event does not declare YET. This is the dual of 400_160 — that test relaxes
// "every declared terminal must be handled" (unhandled => synthesized @panic);
// this one relaxes "every handled branch must be declared" (KORU021).
//
// The authoring story: you sketch the flow the way you actually reason about
// the program — writing the handler arms first — and let the event's terminal
// declarations catch up later. An arm for a not-yet-declared terminal can never
// fire (the event never produces it), so it has ZERO runtime footprint: it is
// pure declaration-debt, not a latent panic. The path that IS declared runs now.
//
// Here `run|zig` returns `.done` (a declared branch), which prints. The `| soon`
// arm handles a terminal the event never declares — it compiles, never fires,
// and stays visibly absent from the declaration as a to-do the lifted-tag /
// readout can list ("thought about, not built yet").
//
// The production guarantee is untouched: remove `~[prototype]` and the same
// source is rejected KORU021 (see 400_166). The annotation is the only thing
// that lets the undeclared arm slide.
~[prototype]
~import std/io
~pub event run {}
| done
| err []const u8
~proc run|zig {
return .{ .err = "declared path ran" };
}
~run()
| done |> std/io:print.ln("done ran")
| err msg |> std/io:print.ln(msg)
| soon |> std/io:print.ln("undeclared arm — never fires, pure declaration-debt")
Actual
declared path ran
Expected output
declared path ran
Flows
flow ~run click a branch to expand · @labels scroll to their anchor
run
Test Configuration
MUST_RUN