typeof()
Jacob Carlborg
doob at me.com
Fri Oct 21 04:26:43 PDT 2011
On 2011-10-21 09:20, Gor Gyolchanyan wrote:
> Actually, the best idea would be to enable full reflection (much more
> complete, then what we have now) by default and allow to remove it on
> demand.
> Just like the methods being virtual by default, but with ability to
> make them final.
I would like some more runtime reflection capabilities as well. It would
be useful for serialization, be able to do something like this:
auto foo = new Foo;
auto cls = foo.classinfo;
foreach (f ; cls.fields)
{
writeln(f.name);
f.set = "some value";
writeln(f.get);
}
This wouldn't hurt as well:
foreach (m ; cls.methods)
{
writeln(f.name);
f("some value");
}
foo.send("bar", "some value");
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list