Overloads not returning appropriate info. [Field reflunkory]

Adam D. Ruppe destructionator at gmail.com
Sat Apr 6 13:03:31 UTC 2019


On Saturday, 6 April 2019 at 12:20:28 UTC, Alex wrote:
> static foreach (f; typeof(__traits(getOverloads, T, m)))

Why are you using typeof here?

> probably 90% of the mixins are of the form
>
> mixin(`Protection = __traits(getProtection, 
> (`~T.stringof~`).`~name~`);`);


Try following this rule:

NEVER use .stringof.

> Protection = __traits(getProtection, T.name);

But (unless T.name is private; this is a design flaw in 
__traits(getProtection)),

__traits(getProtection, __traits(getMember, T, name))

will work.


More information about the Digitalmars-d-learn mailing list