○
Planned This feature is planned but not yet implemented.
Feature: Wildcard patterns in comptime
Code
// Test 310_011: Wildcard Patterns in Taps (Library Syntax)
// Tests universal wildcards with Transition metatype
//
// With nested invocation support, `* -> *` matches ALL invocations:
// - hello (top-level)
// - goodbye (nested inside hello's continuation)
// Note: Tap-inserted invocations (observer) are marked with inserted_by_tap
// to prevent infinite recursion and confusing self-matching.
// Result: observer fires 2 times (once after hello, once after goodbye)
const std = @import("std");
~import "$std/taps"
~event hello {}
| tap_target {}
~event goodbye {}
| tap_target {}
// Observer returns a branch because it's called from tap continuation
~event observer {}
| tap_target {}
~proc hello {
std.debug.print("Hello executed\n", .{});
return .{ .tap_target = .{} };
}
~proc goodbye {
std.debug.print("Goodbye executed\n", .{});
return .{ .tap_target = .{} };
}
~proc observer {
std.debug.print("Universal observer fired!\n", .{});
return .{ .tap_target = .{} };
}
// Universal tap - observes ALL events with wildcard source
// Must use metatype (Transition) because wildcard matches different event shapes
~tap(* -> *)
| Transition |> observer()
| tap_target |> _
// Execute both hello and goodbye - tap should fire for both
~hello()
| tap_target |> goodbye()
| tap_target |> _
Expected Output
Hello executed
Universal observer fired!
Goodbye executed
Universal observer fired!
Test Configuration
MUST_RUN