So I'm designing a compile-time mechanism. I go:

// I have a few interfaces
interface W1 {}
interface Foo {}

// my class implements them
class X : W1, Foo {}

void foo(X a)
{
    // let me check if this code knows that X implements W1
    enum r = anySatisfy!((a => is(a == W1)), InterfacesTuple!X);
    writeln(r)
}

And it prints true. Great.
Ok, better make sure it prints false when X doesn't implement W1. So I change it:

class X : Foo {}

I run it and the output is...

10EAC9DDC

WTF?

What's the type of r now?

    pragma(msg, typeof(r));

And it outputs...

bool function(Foo a) pure nothrow @nogc @safe

WTF?

And that concludes today's episode of WTF.

Reply via email to