The glorious @xkcdRandom Zig builtin

50 points by wofo


andrewrk

It's a really handy function which is why it's already built in to zig! In fact it only requires one keystroke to input, and it's already available as a primitive, always in scope ;-)

bfiedler

I think it is a poor choice of title, since it is not about @xkcdRandom being built-in to Zig, but about how Zig built-ins are implemented.

technetium

I'm not opposed to an LLM being used here, but some depth would have been appreciated. What files were modified? What issues did you run into? As someone with little understanding of Zig compiler internals, were only the intermediate stages of the compiler modified or did you have to hack on the parser as well? When does Zig resolve @builtins? At what stage are they executed?