traits getProtection

Adam D. Ruppe destructionator at gmail.com
Tue Apr 3 06:30:25 PDT 2012


On Tuesday, 3 April 2012 at 13:14:00 UTC, Robert Jacques wrote:
> As someone who has implemented a runtime reflection library in 
> D, it is entirely possible to detect whether a function is 
> marked private/protected or not using __traits today.

How did you do it? __traits(compiles) is the best I could
find, and that breaks down if you are friends (easy to
happen with mixins, even if the code is in a separate file)
and is kinda fragile in general since it will swallow unrelated
errors too.



More information about the Digitalmars-d mailing list