Writergate: Zig I/O Interface Overhaul

Writergateis the informal name for Zig’s I/O interface overhaul that began in late 2023 and culminated in August 2025 with the complete removal ofGenericWriter,GenericReader,AnyWriter, andAnyReader. If you’ve touched Zig I/O code recently, you’ve felt the impact.

The old API used generic types with type parameters:

The new API uses concrete types with vtables and explicit buffering:

The old generic design poisoned APIs: any function accepting a writer became generic, which forced all containing structs to become generic. Andrew Kelley’sWritergate PRdescribes the old interface as “poisoning structs that contain them”. I’ve seen this pattern infect entire codebases: oneanytypeparameter spreads until half your library is generic. It limited API reusability and hurt compile times.

The follow-up in Zig 0.16 treats I/O like memory allocation: code depends on anIoinstance the same way it depends on anAllocator. This enables:

I’ve hit all of these at least once: