
David Abrahams wrote:
Stefan Roiser <stefan.roiser@cern.ch> writes:
On 31 Jan 2006, at 19:40, David Abrahams wrote:
Stefan Roiser <stefan.roiser@cern.ch> writes:
On 30 Jan 2006, at 17:08, Stefan Seefeld wrote:
With interaction with objects I meant e.g. through the meta-level instantiate a class, get/set the data member values, call a function on that instance, retrieve the function's return value and so on. I may have missed that, but I couldn't find examples on the synopsis page for this functionality.
Reflex code for this would look something like
Type t = Type::ByName("foo"); Object instance = t.Construct(); Object ret_obj = instance.Invoke("myFunction"); Very interesting. Where do you get the object code for foo::myFunction? Or have you implemented a full C++ interpreter? foo::myFunction will be invoked through a stub function which is part of the dictionary library for class foo. A dictionary library may be dynamically loaded in a program.
Soooo.... what about templates? Do you have to do something to manually instantiate them? Or do you do some kind of on-the-fly compilation?
Since templates are not types, I would leave out the instantiation of templates into types, which is a compile-time mechanism, from a run-time reflection system, and concentrate instead on finding information about types ( and objects ), and invoking objects from types. Of course an already instantiated template class or template function is a type, and should be subject to run-time reflection like any other type.