Learning: Zig Programming Language

18 days ago
2

Streamed on 2024-12-26 (https://www.twitch.tv/thediscouragerofhesitancy)

I've wanted to take the Zig programming language for a test drive and today is the day. I scanned through some of the Zig information on the webpage, downloaded it and installed it. To learn a programming language the best thing to do is have a project. I have never done an Advent of Code (AOC) so that's what we'll do. I don't want someone in the stream to know the solutions so I went back in time to the 2020 AOC.

I worked my way through three days of the 2020 AOC. We solved the puzzles and parts of it were easy enough with Zig. However, there are some usability and documentation issues. It is not obvious or easy to find how to do things. For example, in the case of reading a file line-by-line all the examples won't work with Windows line endings. I found various feature requests and forum discussions on the topic from 2020 (coincidentally the same year as our AOC) and it hasn't been addressed since then. The first AOC day puzzle I ended up reading in the whole file, then scanning it myself for the lines. The second day of AOC I read the whole file and then used std.mem.tokenizeAny on the text. This was better, but I still don't like it. Luckily the AOC day 3 didn't need any line splitting.

It doesn't feel like Zig is ready for prime-time. Maybe I'll revisit it later.

Loading comments...