Introspection - how?
Vincent
thornik at gmail.com
Tue May 19 05:43:07 PDT 2009
Hello, guys!
I have a question related D's introspection. I try to solve serialization task (implementing JSON protocol)
and stuck at very start: getting all class' fields with types, names and values. Just test code:
Thread d;
foreach(mi; d.classinfo.getMembers(null))
13: writefln(mi.name);
test.d(13): Error: function object.MemberInfo.name () does not match parameter types ()
test.d(13): Error: mi.name can only be called on a mutable object, not const(MemberInfo)
I'm confused with such strange error: what is a problem with using MemberInfo? I just try to GET info, not WRITE!
Anybody have idea how to get info about members? (see task above)
Thanks.
More information about the Digitalmars-d
mailing list