✓
Passing This code compiles and runs correctly.
Code
// Abstract events: `[abstract]` declares a signature; a `proc` in the same
// file is an optional default implementation; `module:event = ...` provides
// THE implementation. Within an implementation, calling the event name
// delegates to the default. Resolved at compile time — no runtime dispatch.
const std = @import("std");
// Example 1: Abstract event WITH default implementation
// The default can be called from within implementation via delegation
~[abstract] tor coordinate { ctx: i32 } -> i32
~proc coordinate|zig {
std.debug.print("Default coordination: {}\n", .{ctx});
return ctx;
}
// Example 2: Abstract event WITHOUT default implementation
// User MUST provide implementation or compile error
~[abstract] tor process { data: i32 } -> i32
// Helper proc for Example 4
~tor double { value: i32 } -> i32
~proc double|zig {
return value * 2;
}
// Example 3: Implementation that delegates to default and extends
// The module qualifier (input:) marks this as an impl override
// Module name is derived from filename: input.kz -> "input"
~input:coordinate =
coordinate(ctx: 42): f -> f + 1 // Delegates to default
// Example 4: Implementation that provides complete logic
// No delegation to default (there isn't one for 'process')
~input:process =
double(value: data): r -> r
// Use the implemented events
~coordinate(ctx: 10)
~process(data: 5)
Actual
Default coordination: 42
Expected output
Default coordination: 42
Flows
subflow ~coordinate click a branch to expand · @labels scroll to their anchor
coordinate (ctx: 42)
subflow ~process click a branch to expand · @labels scroll to their anchor
double (value: data)
flow ~coordinate click a branch to expand · @labels scroll to their anchor
coordinate (ctx: 10)
flow ~process click a branch to expand · @labels scroll to their anchor
process (data: 5)
Test Configuration
MUST_RUN