Boost logo

Boost :

From: Edward Diener (eddielee_at_[hidden])
Date: 2006-02-01 19:51:41


David Abrahams wrote:
> Edward Diener <eddielee_at_[hidden]> writes:
>
>> David Abrahams wrote:
>>> Stefan Roiser <stefan.roiser_at_[hidden]> writes:
>>>
>>>> On 31 Jan 2006, at 19:40, David Abrahams wrote:
>>>>
>>>>> Stefan Roiser <stefan.roiser_at_[hidden]> 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
>
> That presumes that the only thing worth reflecting about are types. I
> of course want reflection into templates (and not just class
> templates, either). But -- no offense intended of course --

No offense taken.

> unless
> you're part of this effort, I'm not really asking what you would do.
> I want to know what the Cern people are doing and are planning to do.

The Cern people will have to speak for themselves.

I was not intending to speak for Reflex but giving my own opinions on
the matter. However my undestanding, from the docs, of Reflex is that it
is a run-time reflection mechanism, even though its dictionary is built
prior to run-time. If that is so that it is a run-time mechanism, I do
not think that reflecting about template classes and/or template
functions should be a run-time task, since at run-time instantiated
template classes and/or template functions become types. Nor do I
understand how reflection about templates at run-time could give any
advantage to a programmer.

I think that there may be a very good case for a compile-time reflection
mechanism which could reflect templates, and which would be available to
an expert template metaprogrammer like yourself, and many others doing
template programming. at compile-time. But I can not see how this would
be done unless built-in to the language or particular compilers
themselves as an extension to the language. But that is much more your
province than mine, so you may have much better ideas how this could be
done than I do.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk