Subject: Re: [boost] Is there any interest in a library which solves C++ class reflection feature just like Java does?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-12-07 07:42:32
Le 07/12/11 10:28, Matus Chochlik a écrit :
> On Tue, Dec 6, 2011 at 2:37 PM, jinhua luo<ljh.home.king_at_[hidden]> wrote:
> OK let me say this so you don't get me wrong: I welcome any
> attempt to add reflection to C++, I would very much like to have
> reflection in the C++ standard with the full support of the compiler,
> and I don't care on whose design it is based.
> What I care about is that it is done properly, i.e. that it is not tailored
> for a specific goal ORM, Serialization, RPC, GUI geneation, parser generation,
> whatever .. but that it would support all of these and much more.
> It should provide as much meta-data as possible even if some of it
> might not be obviously usable in some scenario (it might be in others), etc.
> It also should be compile-time because then you can use it with all the
> great meta-programming tools implemented in Boost and elsewhere.
> If you have a solid compile-time foundation you can implement run-time
> reflection even, dynamically loadable easily.
>> 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)
> The syntax is complex only if you need to specify all details manually.
> There are however the quick-registering macros that simplify the
> registering quite a lot.
I don't think that a compile-time reflection library is in competition
with a run-time library. Both approaches are complementary, and I'm sure
that the Boost community will appreciate both approaches if the library
is well designed.
>> 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++11 is a standard now and Mirror (AFAICT) doesn't use anything gcc-specific.
> I know that the release cycles for compilers are quite long, but I hope that
> we'll get good if not full support for C++11 soon.
The fact that a library need c++11 support only restrict the compilers
that can be used with. I guess that C++11 only libraries are welcome in
Boost. Of course, if the library can be used on C++98 compilers with
minor limitations, the number of potential users will be higher.
So please, don't start a discussion stating that we need a
compile-time/run-time or c++11/c++98 library. All the combinations have
its usage, each one with its advantages and liabilities.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk