Comment by samatman
1 day ago
I love it. Easily one of my favorite things about the language.
Example: shifting more than the width of the shifted integer is illegal behavior in Zig: therefore, the, what, shiftand? let's go with that, the shiftand for a u64 must be a u6 or smaller.
Sounds annoying? No, it's great! Check this out:
const CodeUnitKind = enum(u2) {
low,
high,
follow,
lead,
};
const CodeUnit = packed struct(u8) {
val: u6,
kind: CodeUnitKind,
};
It's really nice!
No comments yet
Contribute on Hacker News ↗