A few quick thoughts on Zig
A few quick thoughts on Zig
A few quick thoughts on Zig
2021-12-05

I love to jump from programming language to programming language whenever I feel I need a jolt in my world(view) of programming. This time I did not stay in the world of Zig long enough to build anything with it, but I'm glad that I stopped in and had tea, so to speak. The last month or so that I have spent working in Rust in my spare time has given me a bit more confidence in the idea of systems programming, and so I took a quick detour to consume some articles, podcasts, and talks about Zig. It seems very cool, but it's been a bit harder to wrap my head around some things (even though it is simpler than Rust, I'm sure, by far). With that said, I'm mostly struggling with memory management, something I've never had to do before. Even Rust manages that for me, I think, at least until you need to do some kind of edge-case customization and do it yourself instead of using the borrow mechanisms of the language.

Anyway, I did the first 50 or so ziglings and that has been an excellent introduction. But when Advent of Code rolled around and I tried to do the first challenge with Zig, I got stuck trying to open a file into memory (I didn't want to inline the inputs for the 1st challenge). I found this blog post which gave me a good overview of how things work, and finally seeing some memory management in context really made some things a bit more clear. But with that said, diving into a new language's standard library and doing Advent of Code felt like too much.

I was thinking that I might rebuild Laundromat in Zig, but now I'm thinking I should just build it in C. I'm never going to really know what these new languages are building on and trying to improve until I see the pains of C, right? So maybe I will do that. I'm not sure, yet. It's taken me about 5 years of programming to work my way toward C. Maybe now is the time.

Once I finish the firn re-write in Rust, that is.