WIP: comptime experiments

This commit is contained in:
Laurens Miers 2024-09-25 12:20:34 +02:00
parent 7417f01d5d
commit b68855fc2d
10 changed files with 57 additions and 15 deletions

View file

@ -123,8 +123,8 @@ fn isADuck(possible_duck: anytype) bool {
// Please make sure MyType has both waddle() and quack()
// methods:
const MyType = @TypeOf(possible_duck);
const walks_like_duck = ???;
const quacks_like_duck = ???;
const walks_like_duck = @hasDecl(MyType, "waddle");
const quacks_like_duck = @hasDecl(MyType, "quack");
const is_duck = walks_like_duck and quacks_like_duck;