hello
if i remember correctly comptime stuff changed not so long ago.
pub fn getAttributeFromType(
comptime T: type
) Attribute {
comptime switch(T) {
i8 => return Attribute.init(.i8, .x, false),
u8 => return Attribute.init(.u8, .x, false),
i16 => return Attribute.init(.i16, .x, false),
u16 => return Attribute.init(.u16, .x, false),
i32 => return Attribute.init(.i32, .x, false),
u32 => return Attribute.init(.u32, .x, false),
f16 => return Attribute.init(.f16, .x, false),
f32 => return Attribute.init(.f32, .x, false),
f64 => return Attribute.init(.f64, .x, false),
else => {
if( comptime @hasDecl(T, "is_xy") ) {
var attr = getAttributeFromType(T.Element);
attr.size = .xy;
return attr;
}
@compileError("Given type '" ++ @typeName(T) ++ "' isnt supported.");
}
}
}```
so in this example i dont even know if either comptime (in the code, not for the argument) are needed at all. since the argument is comptime, isnt the whole function comptime?
thanks
