Is runtime introspection in a working state?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Feb 2 14:26:58 PST 2011
After exploring object.d/di I've found upon some functions I can use on a type returned by .classinfo. But "getMembers" which I'm interested in doesn't seem to work:
import std.stdio;
class Foo
{
int x;
void bar()
{
}
}
void main()
{
Foo foo = new Foo();
auto info = foo.classinfo;
auto barField = info.getMembers("bar");
writeln(typeid(barField)); // const(const(object.MemberInfo)[])
writeln(barField.length); // 0
auto fields = info.getMembers(null);
writeln(typeid(fields)); // const(const(object.MemberInfo)[])
writeln(fields.length); // 0
}
I can get other methods to work, such as toString and tsize. But no luck with getMembers.
More information about the Digitalmars-d-learn
mailing list