✓
Passing This code compiles and runs correctly.
Code
// PINS: the constructor's CONSUMPTION path — deriving a NEW struct type from an
// EXISTING type's fields. `std/types:fields-of(Player)` is a comptime traversal
// SOURCE (emergent iteration, like ~for — it pulses `! each f` over Player's fields,
// not an iterator fed to a loop); `field(f.name, f.type)` rebuilds each into
// PlayerSnapshot. Round
// reads the fields via Zig `@typeInfo` in the lowered code — NO registry (generation
// AND consumption both lower to `@Type`; Zig is the registry for a lowered type). A
// Koru-level type registry — reasoning about type SHAPE at Stage C, before Zig — is
// the north star this consumption path gestures at, NOT what this pin requires.
// `f.name` / `f.type` are the reflected field spec. Surface PROVISIONAL.
~import std/constructor
~import std/types
const std = @import("std");
~std/types:struct(Player) {
name: []const u8,
health: i64,
}
~std/constructor:struct(PlayerSnapshot)
! construct |> std/types:fields-of(Player)
! each f |> std/constructor:field(f.name, f.type)
~event main {}
~proc main|zig {
const s = PlayerSnapshot{ .name = "Alice", .health = 100 };
std.debug.print("{s} {d}\n", .{ s.name, s.health });
}
~main()
Actual
Alice 100
Must contain:
Alice 100Flows
flow ~struct click a branch to expand · @labels scroll to their anchor
struct (expr: Player, source: name: []const u8,
health: i64,)
flow ~struct click a branch to expand · @labels scroll to their anchor
struct (expr: PlayerSnapshot)
flow ~main click a branch to expand · @labels scroll to their anchor
main
Test Configuration
MUST_RUN