Some cool language tricks
Ziggit
Some cool language tricks
1. Figuring out if a value is comptime pub inline fn comptimeKnown(val: anytype) bool { const Tuple = @TypeOf(.{val}); return @typeInfo(Tuple).@"struct".field_attrs[0].@"comptime"; } This one is pretty straightforward if you know how comptime fields work. 2. Figuring out if a value is comptime, part 2 comptime fields are being debated for removal. This absolutely devious workaround was posted by Fri3dNstuff, at https://codeberg.org/ziglang/zig/issues/32045#issuecomment-13664645. pub ...
0 comments
No comments yet.