Avoiding __traits(getAttributes, ...) on alias

Vlad Levenfeld via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 9 16:46:48 PDT 2014


I've recently found out that you can deal with the abundance of 
backticks and escapes in a couple of ways:
   q{ your code here... }
will resolve to a string but your editor can still highlight it 
as D code, making it more readable.
also, turning things like:
   mixin ("if ("~expr~")")
into:
   if (mixin(expr))
can improve readability but beware I've noticed that sometimes 
this is not equivalent to the previous version and I'm not sure 
how or why that happens.
In particular I notice that

   mixin("const bool value = "~expr~";)");
and
   const bool value = mixin(expr);

are not the same, for some reason.


More information about the Digitalmars-d-learn mailing list