○
Planned This feature is planned but not yet implemented.
Auto-dispose for obligations in @loop branches not implemented
Code
~import app/fs
const std = @import("std");
~event iterate { count: i32 } -> i32
~proc iterate|zig {
if (count < 3) {
return count + 1;
} else {
}
}
~#loop iterate(count: 0): n |> app/fs:open(path: "test.txt")
| opened f |> @loop(n.count) // Auto-close f before @loop
|> _
Expected output
Opening file
Closing file
Opening file
Closing file
Opening file
Closing file
Flows
flow ~iterate click a branch to expand · @labels scroll to their anchor
#loop iterate (count: 0)
Imported Files
// Library module: fs
// Single disposal event
const std = @import("std");
const File = struct { handle: i32 };
// Open a file - returns opened! state (requires cleanup)
~pub event open { path: []const u8 }
| opened *File<opened!>
~proc open|zig {
std.debug.print("Opening file\n", .{});
const f = std.heap.page_allocator.create(File) catch unreachable;
f.* = File{ .handle = 42 };
return .{ .opened = f };
}
// Close - the ONLY consumer of <!opened>
~pub event close { file: *File<!opened> }
~proc close|zig {
std.debug.print("Closing file\n", .{});
}
Test Configuration
MUST_RUN