From: Stefan Seefeld (seefeld_at_[hidden])
Date: 2006-01-30 17:55:24
Stefan Roiser wrote:
>>>What may also be important is, that reflection source code is
>>>produced in a non-intrusive way and that interaction with objects
>>>from the meta-level is possible.
>>That is true for synopsis, too.
> 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.
You are right, that's not possible. I was thinking of interactions
with the objects representing the parse tree, syntax tree, symbol table,
Interacting with the running code may involve quite a bit of work
that, at least when taken in its most general form, requires knowledge
that a parser (or compiler frontend) can not have just from introspecting
Synopsis provides C++ and python interfaces to the internal representations,
and so my hope is that higher level tools, even ones that compile and load
the introspected code, can easily be built (e.g. scripted) with them.
> Reflex code for this would look something like
> Type t = Type::ByName("foo");
> Object instance = t.Construct();
That clearly only works if 'foo' has a default constructor, right ?
Even then, it may involve some other resources to be set up. So, what
knowledge of the code being invoked that way do you require ? Who
would provide the implementation for 'foo', who would provide
the above lines, and who would finally execute them ?
> Object ret_obj = instance.Invoke("myFunction");
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk