digitalmars.D - WTF of the day: meta shenanigans
- =?UTF-8?B?THXDrXM=?= Marques (25/25) Jun 06 2018 So I'm designing a compile-time mechanism. I go:
- =?UTF-8?B?THXDrXM=?= Marques (3/4) Jun 06 2018 BTW I understand what the problem was. I just wanted to publicly
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.
Jun 06 2018
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)
Jun 06 2018