Lack of isPublic isPrivate isProtected compile time reflection features

Basile B. b2.temp at gmx.com
Mon Jul 9 09:24:51 UTC 2018


On Sunday, 8 July 2018 at 21:26:14 UTC, 12345swordy wrote:
> On Sunday, 8 July 2018 at 21:20:27 UTC, Basile B. wrote:
>> On Sunday, 8 July 2018 at 20:58:54 UTC, 12345swordy wrote:
>>> I don't see it anywhere in the std.traits library nor in the 
>>> default compiler traits. This shouldn't be difficult to 
>>> implemented them in the std.traits library isn't it?
>>>
>>> -Alexander
>>
>> hello, look at
>> __traits(getProtection)[1] in the language traits
>>
>> [1] https://dlang.org/spec/traits.html#getProtection
>
> Oh, thank you!
>
> -Alexander

By the way i forgot to mention something : it would not 
necessarily be a good idea to put wrappers named isPrivate(), 
isPublic(), etc. in std.traits because if the wrappers are 
instantiated in std.traits they could not work correctly because 
the symbol that they would inspect would not be accessible (since 
located elsewhere)... I'm not 100% sure if 
__traits(getProtection) is affected but the problem described is 
known as a problem when doing introspection with getMember for 
example.


More information about the Digitalmars-d mailing list