✓
Passing This code compiles and runs correctly.
Code
// Test: Capture from existing value — BLOCK FORM.
//
// `~capture { entity }` — a block holding a single bare expression — binds to
// an existing value instead of building a new struct cell. (Open call,
// flagged 2026-06-11: this replaces the old `~capture(entity)` parens form so
// capture has exactly ONE argument shape: the source block.)
// `captured { field: expr }` updates just that field, preserves others.
~import std/io
~import std/control
const std = @import("std");
const Entity = struct {
id: u32,
health: i32,
pos_x: i32,
};
~event print-health { value: i32 }
~proc print-health|zig {
std.debug.print("{d}\n", .{value});
}
const entity = Entity{
.id = 42,
.health = 100,
.pos_x = 10,
};
~capture { entity }
! as acc |> for(&[_]i32{10, 20, 30})
! each damage |> captured { health: acc.health - damage }
| captured final |> print-health(value: final.health)
Actual
40
Expected output
40
Test Configuration
MUST_RUN