Pierre Beaucamp

A day with Zig

For quite some time now, I've been working on a custom database on the side. As it's tough to juggle a complex side-project & full-time employment, I chose to use Go for this to make my life easier. Go allowed me to have some quick wins early on without spending my energy on learning something new.

Well, that's changing now since I "finally" hit the point where Go is not the right choice for some low level tasks. I knew that I'd need to switch to a different language at one point - so after some considerations I landed on Zig.

Zig is a breath of fresh air. The last time that I was this excited & optimistic about a language was when I discovered Go around 2013. In many ways Zig feels like a more low-level Go, which is exactly what I was looking for.

Unfortunately, it's not all sunshine and roses. It's easy to spot that the language is not very mature yet. For example, some docs seem to have a short half-life. This is especially noticable with third-party material such as blog posts. And if you encounter a problem, the most likely solution is "hidden" somewhere on Reddit or in a Github issue.

But my main gripe so far is the file organization. In Go, everything in a directory ends up in the same namespace. Compared to that, Zig feels like a regression: every file needs to an explicit import. This incentivies creating very large source files. Worse yet, tests in Zig live alongside the source code, making files even harder to read.

In general though, this is something I can live with. Complaining about the file organization feels very nitpicky anyway . I'm now off to porting my parser from Go to Zig. If all goes well, the rest of the application will follow shortly.