✓
Passing This code compiles and runs correctly.
Code
// IMPLEMENTED — the BRANCH-payload twin of 336_007.
//
// `advance` re-mints <active!> on the same handle through a named payload field
// `h`, matching the input field `h` — the `window.paint { win } | painted { win }`
// shape. Because the field names coincide, the output is the SAME entity
// advanced, so `h` should continue and `close` should use `h` directly. Today
// the caller must spend `h` and re-bind (`| advanced p |> close(p.h)`).
//
// Green: the identity payload `| advanced *Handle<active!> |` continues `h`;
// the arm binds `__cont0` and `close` uses it (output_emitted.zig).
import app/held
import std/io
app/held:open()
| opened h |> app/held:advance(h, n: 1)
| advanced _ |> app/held:close(h)
| err e |> std/io:print.ln("advance err: {{ e:s }}")
| err e |> std/io:print.ln("err: {{ e:s }}")
Supporting Files
// Twin of the arrow fixture, for the BRANCH-payload form (raylib's `frames`).
// `advance` consumes `h` and re-mints <active!> on the same handle, but through
// a `| advanced { h: *Handle<active!> }` payload instead of a bare return —
// the payload field `h` names the same entity as the input field `h`.
const std = @import("std");
pub const Handle = struct { _token: u8 };
~pub tor open { }
| opened *Handle<open!>
| err string
~proc open|zig {
const h = std.heap.page_allocator.create(Handle) catch unreachable;
h.* = Handle{ ._token = 0 };
return .{ .opened = h };
}
~pub tor advance { h: *Handle<!open|!active>, n: i32 }
| advanced *Handle<active!>
| err string
~proc advance|zig {
_ = n;
return .{ .advanced = h };
}
~pub tor close { h: *Handle<!active> }
~proc close|zig {
std.heap.page_allocator.destroy(h);
}
Flows
flow ~open click a branch to expand · @labels scroll to their anchor
open
Test Configuration
MUST_RUN