○
Planned This feature is planned but not yet implemented.
Fractal abstract events - the pattern ALREADY EXISTS in compiler.kz!
Code
// Test: Fractal compiler pipeline - ALREADY EXISTS in compiler.kz!
//
// The real implementation is beautiful:
//
// ~compiler.coordinate.default =
// compiler.context.create(program_ast: program_ast, allocator: allocator)
// | created c0 |> compiler.coordinate.frontend(ctx: c0.ctx)
// | continued c1 |> compiler.coordinate.transform_taps(ctx: c1.ctx)
// | continued c2 |> compiler.coordinate.analysis(ctx: c2.ctx)
// | continued c3 |> compiler.coordinate.test_generation(ctx: c3.ctx)
// | continued c4 |> compiler.coordinate.optimize(ctx: c4.ctx)
// | continued c5 |> compiler.coordinate.emission(ctx: c5.ctx)
// | continued c6 |> compiler.metrics.format(...)
// | formatted m |> coordinated { ... }
// | failed f |> error { message: f.message }
//
// Key insights from the REAL code:
// 1. It's a FLOW, not imperative code - the pipeline IS the continuation chain
// 2. Each step is a separate event (compiler.coordinate.frontend, .analysis, etc.)
// 3. Error handling (| failed f |>) is built into the flow
// 4. compiler.coordinate is INTENTIONALLY unimplemented - users override it!
//
// From the comments in compiler.kz:
// "Users can implement compiler.coordinate to customize compilation, or the system
// will fall back to compiler.coordinate.default (via main.zig bootstrap logic)."
//
// The fractal pattern is ALREADY THERE:
// - Override compiler.coordinate → replace whole pipeline
// - Override compiler.coordinate.analysis → replace just analysis
// - Override compiler.coordinate.frontend → replace just frontend
//
// What we're adding with abstract events:
// - Make this pattern EXPLICIT with ~abstract event
// - Enable delegation to default impl from within override
// - Compile-time enforcement of single implementation
~import "$std/compiler"
// Example: User overrides just the analysis step to add AI error explanation
// ~compiler.coordinate.analysis =
// compiler.coordinate.analysis.default(ctx: ctx) // delegate to default
// | continued c |>
// if(c.ctx.errors.items.len > 0)
// | then |> ai_explain_errors(ctx: c.ctx) |> continued { ctx: c.ctx }
// | else |> continued { ctx: c.ctx }
// Example: User replaces whole pipeline for debug builds
// ~compiler.coordinate =
// compiler.context.create(program_ast: program_ast, allocator: allocator)
// | created c0 |> compiler.coordinate.frontend(ctx: c0.ctx)
// | continued c1 |> compiler.coordinate.analysis(ctx: c1.ctx)
// | continued c2 |> compiler.coordinate.emission(ctx: c2.ctx) // skip optimize!
// | continued c3 |> coordinated { ast: c3.ctx.ast, code: c3.code, metrics: "debug" }
// Placeholder for test framework
~event test.placeholder {}
| ok {}
~proc test.placeholder { return .{ .ok = {} }; }
~test.placeholder()