✓
Passing This code compiles and runs correctly.
Code
// Pins that an imported module's top-level flows run BEFORE the entry file's
// own flows. The module seeds `items` at top level; the entry's flow calls
// the module's `show` tor and must already see both rows. Emitting module
// flows after the entry's flows — the shape this caught — runs the entry's
// world-facing code against an uninitialized module (found via koru-libs
// games/ponkatris: the engine module seeded its world store at top level,
// but the entry's tick loop ran first on an empty store).
import mymod
mymod:show()
Supporting Files
// A module's top-level flows are its initialization: they run before the
// importing module's own flows, so a store seeded at module top level is
// already populated when the entry's flows query it.
import std/store
import std/io
std/store:new(items, capacity: 8) { v: i64 }
std/store:insert(items) { v: 10 }
std/store:insert(items) { v: 20 }
pub tor show { }
show = std/store:query(items)
! query e |> std/io:print.ln("v {{ e.v:d }}")
Actual
v 10
v 20
Expected output
v 10
v 20
Flows
flow ~show click a branch to expand · @labels scroll to their anchor
show
Test Configuration
MUST_RUN
koru.json:
{
"paths": {
"std": "../../../../../koru_std",
"mymod": "mymod"
}
}