A Zig Diary
kihlander.net
kihlander.net
That's putting it a bit mildly from what I recall the last time I used them. They work on LE if you don't color too far outside the lines, but otherwise I would describe their state as "almost completely broken".
Field ordering being endian dependent, while historically how things are done with bitfields, seems questionable to me anyways.
https://ziglang.org/download/0.10.0/release-notes.html#Packe...
The build system and c-interop is amazing, targeting any arch/os from such a small toolchain makes me never want to use makefiles or even cmake again. The language itself definitely has a learning curve tho. Found myself fighting the syntax and needing some common things like sscanf often.
Btw kristoff's 4 part tutorial was really useful to integrate c libs: https://zig.news/kristoff/compile-a-c-c-project-with-zig-368...
The only grips I have, so far, are some syntax idiosyncrasies.
I am also afraid that their metaprogramming system will not turn out to be as a net positive. It is undeniably powerful (like all systems of this type are) and better designed than previous attempts, and yet this lead to issues about readability/debuggability and inflated compilation time.
The old adage, less is more, is something that should be taken into account with programming language design.
This is a case of less is more, in a way.
Instead of having to learn an entirely different, half-baked language to do metaprogramming (C defines/macros), you just have Zig.
The only problem is that even though this approach leads to less additional added syntax for similar tasks, Zig unlocks potential for metaprogramming that goes far beyond C macros. And like with C macros, this could be abused. It's up to the user not to take it too far.
But yes, there's issues with debugability. I hope Zig improves that
In this case, I think the design team might be underestimating the cost of those idiosyncrasies, simply because they've been working with them for so long.
It is hard to keep a fresh eye on a product of any kind when you've spent years looking at it, designer blindness is not something that should be ignored.
But still, it does not really account for their own blindness.
In practice we can rationalize almost everything.
There might be good reasons why they are designed like that, but we outsiders find that syntax idiosyncratic.
Zig has been compiling to AVR targets sucessfully for a very long time.
Since we've made microzig supporting AVR targets (currently atmega328p only, feel free to add more), i'm not using anything else.
Oh and: We can target an ATtiny1616 without problems. avr-libc doesn't officially support the Tiny2 family yet.
I will push my bugfixes for current master branch tomorrow or later, so you can directly play around!
.. and RISC-V. Zig does work with RISC-V, to some degree at least.
I hope Zig support for AVR improves. For legacy reasons. But I don't think we need more AVR going forward. It's rather proprietary, no?
Also, RISC-V support is working quite fine, and i don't see much problems with that.
> But I don't think we need more AVR going forward. It's rather proprietary, no?
AVR is Arduino. It would be a bad action to basically say: "well, zig is not going to support the most widespread maker hardware on the market"