traits getProtection

Robert Jacques sandford at jhu.edu
Tue Apr 3 18:04:15 PDT 2012


On Tue, 03 Apr 2012 08:30:25 -0500, Adam D. Ruppe <destructionator at gmail.com> wrote:

> 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.

I did it by having all the inspection routines in a private template inside a struct in another module.


More information about the Digitalmars-d mailing list