>>225
Zigはインターフェースを持たないからむしろ不便で型安全性も低い
インターフェースによる抽象型を使えないからanytype型で扱ってこのように制約することになる

fn printable(comptime T: type) bool {
return @hasDecl(T, "print");
}

fn callPrint(value: anytype) void {
comptime {
if (!printable(@TypeOf(value))) {
@compileError("Type must have a 'print' method");
}
}
value.print();
}