The new Io interface makes me wanna quit Zig
I've started learning Zig just recently.
I have some background in C, so after reading and watching plenty of materials, Zig seemed like a natural transition. And this was true to a large extent, at least when it comes to syntax, most concepts made sense right away and I liked the language more and more as I learned it. I was walking over Ziglings, but got bored after finishing about a half and decided to just build something as it works better for my brain.
So I chose a small terminal text editor as a first project which felt like a good fit for Zig. The start was nice, I already started getting used to everything a struct, try statements, etc. But the moment I got to the io part, my excitement started to evaporate quickly.
Something as simple as reading from stdin is unreasoanbly hard. At first it looks like I just need a reader, so I declare one. But it turns out a reader does not expose any methods to actually read? It took me a while to figure out that it's interface is what I need:
var stdin_reader = Io.File.stdin().reader(init.io, &buf);var stdin = &stdin_reader.interface;
I was thinking about just using std.c or std.posix everywhere, but then what's the point of using Zig?
Now I need to read from a file. I found some example on how to read from cwd, but I need to read from an arbitrary path. What do I do? I don't know. The documentation is almost non-existent. Google search doesn't help that much either.
I thought maybe I explore some codebases, so I cloned ghostty and tigerbettle, but both use earlier Zig versions with the old primitives. I can't imagine how expensive will it be to upgrade for those guys if starting a new project from scratch is that hard.
Can someone share your experience with the new Io interface? Am I the only one who struggles with it?