Boost logo

Boost :

Subject: Re: [boost] [mixin] Introducing a new library.
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-01-31 02:30:27

Le 30/01/13 20:53, Borislav Stanimirov a écrit :
> Hello,
> Boost.Mixin is a library I'm developing with the idea to someday
> submit it to Boost.
> It is an entity-component system, with full abstraction between
> interface and implementation.
> In short, users can define objects by combining components (often
> referred to from here on out as mixins). A mixin is a regular C++
> class for which two macros are defined. The main thing however are the
> messages. Instead of getting the component with some function like
> `get_component` (which is possible but discouraged in the library),
> users deal with objects only. They can call messages (inspired by
> Smalltalk's messages) which are dynamically dispatched to the
> appropriate mixin.
> The messages (also defined with macros) are the only thing needed for
> a user to call methods from the object's mixins. When defining a
> mixin, the user tells which messages it's going to implement, and when
> adding this mixin to the object a virtual table of sorts is filled and
> the object starts responding to those messages by calling the mixin's
> actual C++ methods.
> Some of the key features are:
> * Multicast messages. A message that is implemented and handled by
> more than one mixin. See the message `trace` in the example. (As
> opposed to unicast messages, that are handled by a single mixin)
> * Object access from within the mixin. The macro `bm_this`
> (Boost.Mixin this). See the renderer do in the example.
> * "Live" object mutation by adding and removing mixins. As
> demonstrated in `change_rendering_system` in the example. This is done
> via the `object_transformer` class and is currently the only way of
> adding mixins to objects.
> * Mixin (and message) domains. The domain is a collection of mixins
> and messages that work together. If you create a set of mixins that
> will never conceivably have to exist in the same object as another set
> of mixins, you should use a different domain.
> Here is a github link to the library:
> A working example can be found here:

IIUC your library is related to the subject-role [1] but a mixin is more
an aspect of an entity than a role.

Could the user define a typed subjects, that is an entity that have some
specific mixins?
Could the user see an object restricted to some of his mixins?


[1] Roles :Conceptual Abstraction Theory & Practical Language Issues

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