✓
Passing This code compiles and runs correctly.
Code
// The `->` twin of 330_113: an obligation PRODUCED through a value-return
// subflow crosses the subflow boundary intact and is still enforced at the
// caller's flow exit, continuation and all.
//
// Worth its own pin because it is the shape that survives a subflow boundary —
// the obligation reaches the caller through `fetch`'s declared return type
// rather than from the minting call directly. An exit check wired only at the
// direct call site would satisfy 330_113 and leave this one unguarded, so the
// pair is what pins "`:` bind and `->` produce carry obligations identically".
import std/io
import app/lantern
tor fetch { } -> *app/lantern:Lantern<lit!>
fetch = app/lantern:light(): l -> l
fetch(): lamp |> std/io:print.ln("in the dark")
Must contain:
was not dischargedFlows
subflow ~fetch click a branch to expand · @labels scroll to their anchor
light
flow ~fetch click a branch to expand · @labels scroll to their anchor
fetch
Imported Files
// The lantern is a resource with a lifecycle the type system knows about.
// `light` mints <lit!>. `douse` is the only thing that consumes it. A delve
// that ends with the lantern still burning is not a losing game — it is a
// program that does not compile.
const std = @import("std");
const Lantern = struct { oil: i32 };
~pub tor light { } -> *Lantern<lit!>
~proc light|zig {
const l = std.heap.page_allocator.create(Lantern) catch unreachable;
l.* = Lantern{ .oil = 3 };
std.debug.print("You strike the lantern. It catches.\n", .{});
return l;
}
~pub tor douse { lamp: *Lantern<!lit> }
~proc douse|zig {
std.debug.print("You pinch the wick. Dark.\n", .{});
std.heap.page_allocator.destroy(lamp);
}
Test Configuration
Compiler Flags:
--auto-discharge=disable