From: Janek Kozicki (janek_listy_at_[hidden])
Date: 2007-06-07 16:34:02
Jeremy Pack said: (by the date of Wed, 6 Jun 2007 11:25:20 -0700)
> > 7. can you explain shortly what Reflection is? Or some URL with
> > explanation, please.
> I think of reflection as runtime type information about the methods of
> a class for which you do not have access to any of its base classes.
> As such, there are a lot of directions one could go with it - I'm not
> sure which direction Mariano will choose. Some of these directions are
> really hard in C++. I think we'll be discussing that a lot in about
> three weeks - and will want lots of input from the community.
I see... Some time ago I've been thinking about similar thing also:
I wanted to create some Scriptable interface. The C++ coder will
register methods in his class using some macros. And later those
methods could be called by some kind of interpreter reading from std::cin.
Eg. you could register method 'int Foo(int)', and later when the
interpreter reads from std::cin a string "Foo(42)" it would parse the
input and call this method with appropriate argument, then print the
I see where the word 'reflection' comes from - the methods of a class
are reflected in some runtime information.
I abadoned this project, but the only way that I could see is to use
macros - one macro per method. Which effectively doubles the length
of *.hpp file with class definition.
Maybe it is possible to write some really magic macro, which would
allow to declare a method in the class and register it in the same
that isn't going to work ;) what to do with brackets, etc?
What's with that semicolon? ;-)
-- Janek Kozicki |
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk