missing: __traits(isPublic (private, etc...)
Lloyd Dupont
ld-REMOVE at galador.net
Mon Jun 20 04:59:49 PDT 2011
I am working a reflection / introspection library (dynamic / at runtime, as
opposed to compile time with template and mixin).
Now I can create "PropertyInfo" classes for property with very little code
and it all works well.
I'm hitting a problem, trying to "register" all property of my class
automatically.
I have a vanilla implementation like that:
=====
void RegisterProperties(T)()
{
foreach(mn ; __traits(derivedMembers, T))
GetProperty!(T, mn);
}
=====
The problem is, it's trying to register private properties! (and of course
fail, due to access rights...)
So far I have test like
===
static if(mixin("__traits(compiles, t." ~memberName ~")") )
{
getter = &GETTER!(T, memberName);
}
====
which test that the thing is a property.
But how could I test it's a ***public*** property?
if not possible, wouldn't it be a nice trait addition?
More information about the Digitalmars-d
mailing list