←back to thread

228 points Retro_Dev | 2 comments | | HN request time: 0.545s | source
Show context
ww520 ◴[] No.44465800[source]
One issue I have with the old reader/writer pattern is that it is not easy to store them in a struct. Reader and writer are passed into a function as 'anytype' which implements any of the read() or write() functions. Often time in a struct's init() function, I want to take in a reader/writer and store it for later use. It's close to impossible since I don't know what type of the field of the struct to store them.

Does the new change make it easier to store reader/writer in a struct?

replies(2): >>44465955 #>>44466407 #
1. norman784 ◴[] No.44466407[source]
I recommend watch this video https://youtu.be/x3hOiOcbgeA
replies(1): >>44467755 #
2. ww520 ◴[] No.44467755[source]
Nice video. I especially like the new 'labeled switch' feature providing a freeform control flow, and the watch/incremental compile feature. I used to use Rust's watchexec to do zig build on changes; now the watch feature is built natively in zig. The IO based async/await stuff seems to be the right direction; it's following the familiar Allocator pattern. The integrated fuzz testing into the compiler tool chain is fantastic; I can write much less unit tests now.

Zig.day looks like a wonderful way to do laid back hackathons. Looking forward to one coming up.