Le 04/04/2012 03:04, Robert Jacques a écrit :
On Tue, 03 Apr 2012 08:30:25 -0500, Adam D. Ruppe
<[email protected]> 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.
That is neat.
It should be provided as lib by std.traits . And no need for language
changes.