Re:A Zig Diary
by zamadatix on Wednesday January 11, 2023 @10:42AM
(#34339680)
I can't wait for Zig to reach a stable point. It has a lot of cool features but right now it (rightfully so at this stage) moves so fast it's nearly impossible to keep up with unless your interest in using Zig is "keeping up with Zig's early development". Not just from a syntax/feature perspective but from a "oh that compiler bug was fixed in commit xyz" or "oh that language feature doesn't actually compile correctly right now if the data is evenly divisible by 4 when run on a little endian target on a Wednesday". Alright maybe not that obscure but you get the idea :).
[ Parent
| on HN ]
Re:A Zig Diary
by throwawaymaths on Wednesday January 11, 2023 @11:09AM
(#34339985)
Can you give an example of a compiler bug you've run into? I feel like they are very rare for most use cases, these days.
I've got a thing for packed structs (network encodings tend to be zealous to use weird bit widths and packings to save a byte on the header) but unfortunately for me they seem to be one of the most troublesome things in the language and every time I return to try them out it seems like there is always more to fix - though I usually get farther and farther in each round. The self-hosted compiler seems to have calmed things with it but there flow of mis compilations still and they tend to hang around for a couple of releases. For a good read of how weird these can be here is a bug report from last month https://github.com/ziglang/zig/issues/13480
Re:A Zig Diary
by throwawaymaths on Wednesday January 11, 2023 @02:18PM
(#34343117)
yeah, that makes sense. packed structs are the place where I had trouble in the past.
While you are right about it not being stable, and about packed struct being a bit wonky, I've been using Zig a lot for some hobby projects and rarely run into problems. APIs are in flux of course, but that usually only takes minutes to fix as long as you keep the compiler reasonably up to date. Maybe there's a fix required every month or so, but it seems that most things are settling down. YMMV, I mostly use the basic stuff and sprinkle some comptime here and there.
Re:A Zig Diary
by AnIdiotOnTheNet on Wednesday January 11, 2023 @01:47PM
(#34342656)
> packed struct being a bit wonky
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.
Re:A Zig Diary
by AndyKelley on Wednesday January 11, 2023 @05:01PM
(#34345602)
Issues with packed structs are finally resolved in 0.10.0:
https://ziglang.org/download/0.10.0/release-notes.html#Packe...