June 07, 2018 WTF of the day: meta shenanigans | ||||
---|---|---|---|---|
| ||||
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. |
June 07, 2018 Re: WTF of the day: meta shenanigans | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luís Marques | On Thursday, 7 June 2018 at 00:33:28 UTC, Luís Marques wrote:
> And that concludes today's episode of WTF.
BTW I understand what the problem was. I just wanted to publicly share my own incompetence :o)
|
Copyright © 1999-2021 by the D Language Foundation