Lloyd Dupont wrote: >trying to learn introspection, I have this simple test method: > >=================== >static void dumpelement(Object o) >{ > if (!o) > return; > > auto ci = o.classinfo; > foreach(mi ; ci.getMembers(null)) > { > writefln("%s . %s", ci.name, mi.name()); > } >} >================== > >However it fails to compile with the following error: (any ideas?) >======= >main.d(57): Error: function object.MemberInfo.name () is not callable >using argument types () const >Building Debug\dtest.exe failed! >
Looks like getMembers() returns 'const MemberInfo' but name() is not declared as const. That's likely a bug in druntime, but as a workaround you can try this: ================== writefln("%s . %s", ci.name, (cast(MemberInfo)mi).name()); ================== -- Johannes Pfau