✓
Passing This code compiles and runs correctly.
Code
// TEST: kernel:init requires | computed |> branch
//
// Without | computed |>, kernel results are trapped inside the kernel scope
// with no way to access them in normal code. The computed branch is the
// exit from the kernel region — it receives the final data after kernel ops
// complete and runs normal (non-kernel) post-processing code.
//
// Each kernel:init checks itself. claims_descendants ensures the outer init
// runs before inner inits, so the outer init enforces this on itself first.
//
// Future: nested/inner kernels may relax this requirement once we understand
// the GPU/CPU segmentation tradeoffs. For now, computed is required.
~import "$std/kernel"
~std.kernel:shape(Body) {
mass: f64,
}
~std.kernel:init(Body) {
{ mass: 1.0 },
{ mass: 2.0 },
}
| kernel k |>
std.kernel:self { k.mass *= 2.0 }
Test Configuration
Expected Error:
kernel:init requires | computed |> branch