News for hackers. Stuff that matters.
Re:Zig in 30 Minutes by AnIdiotOnTheNet on Sunday January 03, 2021 @09:48AM (#25622053)
> 2) Add tagged unions (I do not understand what they are but they exist, maybe some fellow reader here could help me)

It is probably a matter of terminology. For some reason different languages see fit to give the same thing different names.

A union is a type that can be one of several different things. In C unions, there is no built-in way to tell which of those things any given union instance is at any given moment, which can lead to code assuming it is one thing when it is actually another. Tagged unions carry an enum with that that tells you which thing they are right now. Zig will not let you work with a tagged union's value unless you switch on the enum (tag) so you know what you're working with.

> * The same way the Zig compiler is awesome the underlying build file you often wanna write is just horribly documented. I don't understand half of it and it changes a lot. Andrew should really politely ask people on the internet to take down old repos and blog entries. Please document the build system and build file writing better.

Agree wholeheartedly. I've never even bothered to use zig build in years of working with zig because of it. Granted, I make it a rule to rethink what I'm doing if I actually need a complicated set of build steps, but sill.

There are no comments on this comment yet.