Yes, that’s a really good way to put it. I work as an embedded software engineer, and since I started earlier this year at a new company, using C++ has been a dreadful experience. To be fair, I’m definitely stronger in C than in C++, so a lot of it is skill issues. But good lord, that language is painful to use.
For example, I recently ported a custom Raspberry Pi computer vision pipeline. I basically reimplemented some opencv ish functionality in C, and not only was the code cleaner, but it also compiled about 20x faster. While I was porting that awful C++ code, I was actually enjoying myself for once. And yet, at every step, I couldn’t help but think: this would be so much simpler in Zig.
One of the underrated perks of Zig, which I don’t see many people talk about, is the confidence it gives you. Because it’s actually strongly typed, because it’s hard to make dumb mistakes, and because the tooling + stdlib + ecosystem are just solid, you finally get to push your code further without that constant fear of things blowing up in subtle ways.
Maybe that’s just me being junior, but honestly there’s a good 20/30% of optimizations I don’t even attempt in C/C++. The ROI is just not there the time, the pain
, and the risk of adding insane complexity make it really hard to justify.
Take custom allocators, for instance. Sure, you can do them in C, kind of similar to Zig. But the moment you pull in a library, you almost always lose control. In C++ it’s even worse: if you want to avoid the compiler secretly copying stuff everywhere, you have to dive into perfect forwarding, disable copy constructors/operators explicitly, and jump through hoops. And that’s just one example.
Yes, some of this is skill issues, but the fact remains: Zig not only encourages a kind of craftsmanship culture, it’s designed from the ground up to make it easy to do what you want to do without forcing you to stop at some ugly local maximum of “well, I guess that’s the least painful way in C++”
Because obviously techincally you can implement everything in every language, and as long as llvm is behind the codegen, you could technically get the same performance, but from a practical standpoint, there is really not a lot of languages, that i know of, that gives you the kind of confidence, speed of iteration, and power to build complex and performant system as well and as easily as Zig.
Honestly I’m really excited for Zig’s future, what really convinced to invest early was the fact that on top of being a better C in my eyes, unlike other low level languages, it’s designed by a very competent, ambitious, team with a strong vision of what they want to do, and that gives me a lot of confidence that it won’t end up like Nim or V or any other language that start as lean C/C++ competitors and because they lack focus and identify they start to become yet another C++. What kills language for me is really a lack of of consistent vision, every language designed by the community or by a committee is most likely going to end up in the same kind of mess that is C++.