
----- Original Message -----
From: Mathias Gaunard <mathias.gaunard@ens-lyon.org> To: boost@lists.boost.org Cc: Sent: Friday, February 10, 2012 12:12 PM Subject: Re: [boost] PCL - Portable C++ Library
On 02/10/2012 03:14 PM, Dominique Devienne wrote:
Well, just add introspection and reflection to C++ (possibly on-demand instead of an all types and method for example), and the need for MOC pretty much disappears. MOC is not just used for signal/slot, but for introspectable properties, methods (and thus easy runtime integration to JavaScript for example), declaring safe enums, and other stuff still.
Q_CLASSINFO, Q_PROPERTY, Q_ENUMS can all be implemented as regular C++ macros.
They don't depend on introspection at all.
This is very true. In fact, at one place where I worked I wrote a Q_PROPERTY like macro that generated meta data classes that enabled reflection. It worked like this: class SomeClass { PROPERTIES ( property((int) id, get get_id), property((string) name, get get_name, set set_name) ) ... }; It is slighty different than the Q_PROPERTY, just so it can be parseable by the peroprocessor. And everything needed to be defined together in one master macro, to make it easier to index the meta-data classes. It would've been nice to write it like this: class SomeClass { PROPERTY((int) id, get get_id) PROPERTY((string) name, get get_name, set set_name) ... }; But I could never finde a good way to do that. -paul