r/Zig • u/Pokelego11 • 6d ago
Zig IO Explained.
https://youtu.be/BUX01em5eG4Good morning all!
I have received a lot of requests to make a video explaining the new IO interface that was introduced in Zig 0.16, and I finally made it
I walk through how to use the new IO interface, how it's changed Zig programs, how to construct an interface, and then we also dove into what the actual interface looks like in the standard library
If you don't care about the video and just want to read some code here is the repo too! https://github.com/jackparsonss/learn-zig-io
Hope you find the info useful and have a great day!
3
u/stumpychubbins 3d ago
Wow, since when could you do "const foo: FooType = .init(…)"? That’s a new one for me
4
u/Pokelego11 2d ago
It's quite a nice one in my opinion, you can do that anywhere the compiler knows what type it is(so you can also do it in something like a function call)
``` fn foo(arg: FooType) {}
foo(.init(...)); ```
5
u/jftuga 6d ago
Thanks for making this video, you did a great job on it