Discussion: A potential solution to the anytype problem (opens in new tab)
you need to what you can do in zig first before thinking about what it can’t do. i’m basically repeating my point but, the same can be done with the existing zig features like this fn satisfiesAnimal(comptime T: type) bool { var ret = @hasField(T, "age"); ret = ret and @hasField(T, "height") and @FieldType(T, "height") == u8; ret = ret and @hasDecl(T, "eat") and @TypeOf(T.eat) == fn (T) void; return ret; } that new sugar syntax is not worth it. also a builtin like @Self already exists and tha...
Read the original article