Is Zig Adding Too Much Complexity Without Sufficient Reward?

Zig type system makes Zig more complex than C, and time consuming to learn. Question is if it is all worth it. Some reflections.

Erik Engheim
3 min readNov 13, 2020

--

I get your point, you are right that there is indeed a danger for this happening with Zig. I am very torn on these issues myself, as I have seen them working briefly with Haskell and Rust as well as working a lot with Swift.

Very strict typing systems are a two-edged sword. It is alluring with the safety they bring, but often the complexity the type system adds makes you sometime question the value.

E.g. I find that comparing Go and Swift is interesting as I used both a fair amount in the past. Go does from a "modern" standpoint everything wrong. It does not have generics and it does not have optinal types.

Swift in contrast, does on paper, everything right. Very strict type system, generics, optional types, sum types, closure syntax and what not.

Yet in general I found Go programming much more pleasant.

It seems like you experience with Kotlin echos my experience with Swift. One day I could be gushing over all the nasty intricate little bugs that the type system caught for me, while other days I am cursing at the compiler refusing to accept my code, and trying to debug my brains understanding of the type system. Not to mention the verboseness added to deal with optionals an d strict types.

I must confess I often wished that Apple had replaced Objective-C with a modern version of Smalltalk rather that a statically typed language with almost a Nazi attention to order and disipline.

However at the moment I try to see Zig as an alternative to Rust for people who want to to low level programming. And at least I was able to get into Zig, while I pretty much gave up on Rust as there was too much to learn, and I don't have that much time to spend on a hobby interest. Not to mention all that formalism really isn't that fun. You want to build stuff.

Interesting with your contrast with Java and Kotlin. Wonder what I would have thought if I used both more. It seems some of the things you like about Java I really dislike. I think Java is far too strict in how things are organized. The nesting gets too deep. I like things more like Python, Go and Julia then. Or even Swift. Java is not alone. C# also seems to rigid and nested to me. So if Kotlin gives freer organization that would actually seem like a benefit to me.

But many of your other points seem to match many of my own reservations about Swift. But I think unlike you I have not yet firmly decided.

Instead I have simply opted to use dynamic languages when possible. I really enjoy using Julia. I feel the language plays on the same team as me rather than always having to fight the lanugage. With C++ I always felt I was at war with the language. It was always fighting me. Swift is a huge improvement over C++. But there are many aspects of Objective-C I miss.

--

--

Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.