Writergate: Zig I/O Interface Overhaul

(alexrios.me)

34 points | by signa11 2 hours ago ago

9 comments

  • bayesnet 43 minutes ago

    As someone who doesn’t write Zig, I wish the code examples gave type annotations for the writers so I could see the difference between the old generic API and the new `std.Io` interface.

  • sarreph an hour ago

    As someone who doesn't write Zig (but is hoping to soon!), I'm struck when reading this that the new interface seems much more verbose than the old interface... i.e. 6 LoC vs the previous implementation's 3 LoC.

    I was under the impression that verbosity was something that Zig tries to reduce, but perhaps this is not emblematic of other updates to the language?

  • Jowsey an hour ago

    So many Claude-isms in one post. Please stop.

  • Nail2680 an hour ago

    Needing to manually call flush seems like a major issue, is there a friendlier wrapper in the std lib to print and flush and use some static storage for the buffer? Since that seems like it would become step one of any zig project

    • KolmogorovComp an hour ago

      I agree, the less batterie-complete STD become, the more everyone get its own half-baked utility one.

    • eptcyka an hour ago

      It mirrors the C interface.

      • metaltyphoon 32 minutes ago

        Well, printf flushes when \n is encountered. Does zig have something similar?

  • delusional an hour ago

    This reads either AI generated, or written by someone who has gotten too used to AI writing. The structure is off and filled with "Here's what happened next" and "Why that matters" and "X happens, not Y" without context for why I'd care, or why I'd expect Y.