Re: Getting object members

2013-06-13 Thread Szymon Gatner
Thanks a lot Adam, this is what I came with: module main; import std.stdio; class MyObject { abstract string[] getPublicMembers(); } class MyClassBase(T) : MyObject { override string[] getPublicMembers() { return generatePublicMembers!T(); } string[] generatePublicMembers(T)()

Re: Getting object members

2013-06-12 Thread Adam D. Ruppe
On Wednesday, 12 June 2013 at 10:59:42 UTC, Szymon Gatner wrote: I know how to iterate over members when type is known at compile time (with __traits) but I can't find a documentation of how to get them polymorphically, I mean: It hasn't been implemented in the runtime yet (though all the pie

Getting object members

2013-06-12 Thread Szymon Gatner
Hi, I am trying to get members of a class via pointer to Object. I know how to iterate over members when type is known at compile time (with __traits) but I can't find a documentation of how to get them polymorphically, I mean: class Foo { int x, y; } Object o = new Foo(); auto ci = o.cla