Determining protection of another module's member

Atila Neves via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 25 04:06:39 PDT 2014


__traits(getProtection) allows us to know if something is 
private, protected, etc. But how would one go about determining 
that from another module? The problem here is if module foo 
defines a function foofunc that is private, trying to use 
__traits(getProtection) from another module fails to compile.

The problem I'm trying to solve is how to determine if another 
module's member is private without having to resort to 
__traits(compiles). If you're wondering how the 2nd module would 
even know about the existence of that private member, it would be 
via __traits(allMembers). Thanks in advance,

Atila


More information about the Digitalmars-d-learn mailing list