is(x = module) vs. __traits(isModule, x)
Imperatorn
johan_forsberg_86 at hotmail.com
Thu Oct 8 04:58:04 UTC 2020
On Wednesday, 7 October 2020 at 21:01:28 UTC, Stefan Koch wrote:
> On Wednesday, 7 October 2020 at 20:58:21 UTC, Paul Backus wrote:
>
>> Clever. Now try this:
>>
>> writeln(Wrapper!("hello" + 1).compiles);
>>
>> Or this:
>>
>> struct S { int x; }
>> int n = 123;
>> writeln(Wrapper!(S(n)).getMember!"x");
>>
>> Or this:
>>
>> struct S { in x, y; }
>> writeln(Wrapper!S.allMembers);
>>
>> The problem with using templates to wrap __traits is that
>> __traits can do things that templates aren't allowed to do,
>> like take expressions as arguments, or evaluate to expressions
>> rather than symbols or constants.
>
> Hmm seeing this written out I have to say ...
> It does look neat ....
>
> If you submit a DIP I can implement it for you.
> It only looks neat without the underscores though :)
Agree about the underscores. Would be splendid is it was
possible. Dunno how you would fix naming issues though, like is
someone has a function already named some trait
More information about the Digitalmars-d
mailing list