Boost logo

Boost Users :

Subject: [Boost-users] boost.extensions and boost.reflection.
From: Germán Diago (germandiago_at_[hidden])
Date: 2008-09-12 14:18:37


Hello. I'm implementing a property class which uses my own library
(still in early stages) and
I want to extend it to general reflection (not for now) and shared
library loading.
I found boost.extensions, which is not a boost library for now.

I don't know if this is the place to ask for this, if it is not, point
me where I could go. It's great
to see I won't have to taje any more pain to load plugins :-).
I would like to make a feature request. In boost.extensions, factories
are used to construct
types of a derived class with pointers. So, in order to register a new
class, you have to tell which is the base
class to the extensions system. I think there is a better way, with
which you wouldn't need to do
this. It is inspired in this type style of value-based type system:

http://stlab.adobe.com/wiki/index.php/Image:2008_06_26_classes_that_work.pdf

An object which can contain any other object (like boost::any) could
be created. This way (this is how I do
in my own solution) you just have to register a type without worrying
about its base class:

REGISTER_CLASS(myns, myclass)

Now I can do like this:

object_t myobject = introspection::create_object("myns", "myclass");
when I want my object to become "myclass" I do:

myns::myclass & refclass = get_reference<myns::myclass>(myobject);

This works fairly well, and factories go away, freeing the user from
learning more interfaces.
 Just register your type and use it. Everything else is transparent.
The interface is simple, no factories or anything else to handle. This
can be also used from shared libraries without problems.
At least, I think that it should be provided a way to register a
factory of non-pointer types. In the documentation it says
a pointer is created for the animal class, disabling this type of
value-based registration.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net