|
Boost : |
Subject: Re: [boost] Is there any interest in a library which solves C++ class reflection feature just like Java does?
From: jinhua luo (ljh.home.king_at_[hidden])
Date: 2011-12-06 08:37:17
Hi,
I have a quick look at the Mirror reflection utilities, although no deep
investigation, I have some opinions about it:
a) complex reflection declaration syntax (e.g. to describe the prototype of
some method, it needs to use macro per parameter, but in my way, it's more
easier and native: you just need to copy and parse the prototype from the
class definition)
b) depends on C++11 features (as mentioned in the web site, It has been
tested and is currently known to work with the gcc 4.5.1 and higher), but
my way does not require new versions of C++ standards, so it supports VC7
or higher, and all gcc versions.
c) the source codes of the Mirror reflection utilities is a bit huge and
complex than my one: my reflection library has only 3 header files and 1
source file, and the codes are about 1200 lines.
Regards,
JinHua
2011/12/6 Matus Chochlik <chochlik_at_[hidden]>
> On Tue, Dec 6, 2011 at 2:40 AM, jinhua luo <ljh.home.king_at_[hidden]>
> wrote:
> > Hi,
>
> Hi,
> >
> > In brief, I'd designed and implemented somehow C++ class reflection based
> > on boost libraries.
>
> Did you have a look at the Mirror reflection utilities ?
>
> > It has some unique advantages:
> > a) it doesn't require code generator
>
> Good, but it is not so unique
>
> > b) platform independent and compiler independent (I tested it on Windows
> > and Linux, with vs2008 and gcc respectively)
>
> Nice,
>
> > c) it's non-intrusive for the class definition, instead, you just need to
> > declare and describe your class via some straightforward macros anywhere
> > (header file or source file, and may be within any namespace), which also
> > means you can wrap an external third-party library (which you have no way
> > to touch the source codes) and reflects it classes.
>
> This is not unique either
>
> > d) Cross shared library boundary, you can dynamic load the shared library
> > and reflect the classes within it, without need to export any symbol
> > manunally in C wrapper function way
>
> I believe (and I have some expertise in using and implementing reflection
> in C++ to base that belief upon) that the basic reflection should
> compile-time and any run-time reflection should be built on top
> of that.
>
> > e) the API looks like Java reflection API
>
> I don't think that this is a good idea, and I've seen several
> (scientific) papers where people don't think it either.
>
>
> BR
>
> Matus
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk