Writergate migration experience

Is there any reason you cant use empty buffers for stdout/err, that should give you the same behaviour without having to flush at all.

The ‘new’ behaviour isnt new, its just part of the interface now, whereas the old api had buffering as a separate BufferedReader/Writer implementation that wrapped another reader/writer.

This isnt the new Io, this is the new data streaming. The upcoming Io could have been implemented with the old API.

the new api does make some footguns more prevalent, which newcomers aren’t familiar with. There are multiple things in works that address this.

The motivation is much improved performance and efficiency, definitely worth the change. As stated already, buffering isn’t new, it’s just more integrated now. Btw one of the benefits of buffering is it does the chunking for you, so you can naively write your data without caring.

Definitely missing some simpler wrapper functions though, I expect they will be added by next release.

More regarding async, I think you are confusing the Reader/Writer interfaces with the Io interface, which is wip and expected for next release.

It’s to be expected, zig is still in heavy development its just not worth doing these things when they are actively changing.

But that is a good idea of what should be added to the website when zig is nearing 1.0

1 Like

LOL … Probably lack of knowledge on my side! I just didn’t know this. Everybody’s talking about how to avoid pitfalls with the buffer, but I never saw a simple example of not using one at all…

2 Likes