On 2012-07-21 21:44:51 +0000, Andrei Alexandrescu <seewebsiteforem...@erdani.org> said:

Please chime in with thoughts.

Unifying runtime and compile-time reflection is a good idea, in theory at least. At least it'd make compile-time reflection easier. But when I think about the use case, unification the way you're proposing doesn't seem that great.

If you need runtime reflection in one class, you probably need it on all the derived classes too. That's the real problem runtime reflection solves: it allows you to know something about the subclasses you might otherwise not know about (because your code only know the base class).

So to make runtime reflection not a hassle, the thing that generates the runtime reflection info should be inherited somehow.

The other thing is: you very rarely need runtime reflection of everything. Especially, why would you ever need runtime reflection for a struct, where all the reflected info is available at compile time? And why create info for all fields and methods in a class in a case where all you need to get at is a pair of serialize/unserialize functions?


--
Michel Fortin
michel.for...@michelf.ca
http://michelf.ca/

Reply via email to