Boost logo

Boost :

Subject: [boost] [mirror] automatic reflection / boost.mirror still in development?
From: strasser_at_[hidden]
Date: 2009-08-21 11:32:16

is boost.mirror (sandbox: ) still
in development? looks a bit abandonded to me.

when I first saw it I was not too excited about it because I don't
think a reflection library that requires the user to register every
c++ construct manually is very usable.

but GCC recently (finally) integrated a plugin infrastructure, so it
would be possible to automatically generate reflection information.
I've worked with the GCC internal tree before, it's pretty close to
the c++ constructs in the early stages.

something like this would be possible:

//include result of GCC plugin of test.cpp:
#include "test.rpp"

class myclass{
        int myvar;
        double myfunction();

int main(){
        typedef reflection::myclass::myvar::type ret;
        typedef reflecton::myclass::myfunction::type::return_type ret;

//or, lookup in MPL map:
template<class T>
char const *lookup_name(){
        return reflection::type<T>::name;

or anything else you can do with MPL sequences, like iterating over
class members.

this would have some downsides though:
  - GCC
the library user must install GCC. other compilers can still be used
for compilation, but the code to be reflected must be portable to GCC.

  - license
the code generating plugin must be GPLed. that does not affect the
license of the user code or other parts of boost though.

acceptable downsides imho, given that there are no practical
alternatives in sight, like a standard conforming boost C++ parser.

what do you think?

Boost list run by bdawes at, gregod at, cpdaniel at, john at