008 mixed impls

✓ Passing This code compiles and runs correctly.

Code

// Test demonstrates the concept of mixed implementations
// In a real scenario with multiple procs for same event,
// if ANY proc is impure, the event should be marked impure

~import "$std/io"

const std = @import("std");

// Pure event
~event pure_op { x: i32 }
| done { result: i32 }

~[pure]proc pure_op {
    return .{ .done = .{ .result = x * 2 } };
}

// Impure event
~event impure_op { x: i32 }
| done { result: i32 }

~proc impure_op {
    std.debug.print("[IMPURE] Processing {}\n", .{x});
    return .{ .done = .{ .result = x * 2 } };
}

// Flow that composes impure operations
// Demonstrates that purity is per-event: if any callee is impure, the flow is impure
~event mixed { x: i32 }
| done { result: i32 }

~mixed = impure_op(x: x)
| done d |> done { result: d.result }

~mixed(x: 21)
| done d |> std.io:print.ln("Result: {{ d.result:d }}")
input.kz

Expected

[IMPURE] Processing 21
Result: 42

Actual

[IMPURE] Processing 21
Result: 42

Test Configuration

MUST_RUN