Is this a new bug ?

user1234 user1234 at 12.de
Sat Jul 20 06:43:03 UTC 2019


On Saturday, 20 July 2019 at 05:21:01 UTC, Newbie2019 wrote:
> On Saturday, 20 July 2019 at 04:18:15 UTC, Adam D. Ruppe wrote:
>> show me what you're doing now and I'll see which case it is. 
>> Most the time I see these, the code is significantly 
>> simplified and bugs fixed by removing the usages of these 
>> strings..
>
> I want to do this in betterC:
>
> template asPure(string P, alias Fn) if 
> (isFunctionPointer!(typeof(&Fn))) {
> 	enum N = __traits(identifier, Fn);
> 	enum string asPure = "private alias " ~ N ~ "_P = " ~ 
> typeof(&Fn).stringof ~ " pure;\n" ~ "__gshared immutable " ~ N 
> ~ "_P " ~ P ~"= cast(" ~ N ~ "_P) &" ~ N ~ " ;" ;
> }

use `__traits(identifier)` instead of `.stringof`, see 
https://dlang.org/spec/traits.html#identifier.

as explained this is not a new bug, not even a bug according to 
me.


More information about the Digitalmars-d-learn mailing list