020 generics ring buffer e2e

○ Planned This feature is planned but not yet implemented.

Full end-to-end ring buffer demonstrating generics-as-library pattern

Code

// Test: Full end-to-end ring buffer using event globbing
//
// This demonstrates the complete generics-as-library pattern:
// 1. Declare generic type with glob: ~event ring.*
// 2. Instantiate with params: ~ring.new[T:u32;N:64](...)
// 3. Use generated type: ring.enqueue(42)
//
// The ring buffer is fully typed at compile time.
// No runtime overhead, no type erasure, no boxing.

~[comptime|transform]pub event ring.* {
    event_name: []const u8,
    expr: Expression,
    source: Source,
    item: *const Item,
    program: *const Program,
    allocator: std.mem.Allocator,
}
| transformed { program: *const Program }

~proc ring.* {
    // Implementation would parse params, generate full ring buffer type
    // with enqueue, dequeue, peek, etc.
    // See 700_011 for param extraction example.

    // For e2e test, verify the full flow works:
    // - Parser accepts ring.new[T:u32;N:64]
    // - Transform runner matches ring.* glob
    // - Transform extracts T, N params
    // - Transform generates typed Zig struct
    // - Generated code compiles and runs

    return .{ .transformed = .{ .program = program } };
}

// Full usage example
~ring.new[T:u32;N:64](name: "event_queue")

pub fn main() void {
    // Use the generated ring buffer
    var eq = event_queue{};
    eq.enqueue(42);
    eq.enqueue(123);

    const val = eq.dequeue();
    std.debug.print("Dequeued: {}\n", .{val});
}
input.kz