Subject: [boost] [Mixin] Some comments
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2015-01-10 14:46:42
First of all, I want to say that I like your library too much. It is
quite close to a library I was working one EntityRoleSubject. You
library could be extended to to take in account the subjective
programming paradigm (see below).
I have some comments/remarks/questions:
* I have some doubts about the name mixin. What a mixin has more than a
facet or an aspect? Mixins in C++ have a specific mean in the context of
CRTP. Why have you chosen the mixin name?
* The construction of the mixins in the tutorial is done always with the
default constructor. Can we do emplace construction? How can you ensure
the invariants of some mixing classes?
* The priority of the messages doens't compose well. The user needs to
have a global view of the application so that it can assign the correct
priority. I have not a better suggestion, but I think that this issue
would need more insight.
* Respect to subjective programming: it would be great to be able to
create subject from an entity so that only the mixins of the subject
would play when a reference to this subject is addressed.
subject<Mix_1, .... Mix_n> s (o);
o.get<Mix_k>() works as expected.
o.get<Other>() compile fails if not equal to any Mix_k
* The macro bm_this :(
* I would like to see what is behind the scenes the different macros in
an implementation section.
* The entity-mixin relation is not recursive, that is, a mixin can not
have associated mixins, or can them?
* Can a mixin D inherit from another mixin B? Could the mixing D be
retrieved when getting the mixing B?
o.get<B>()->f() // f been a virtual function on B?
* The example of the mixin headphones_player show that the play()
implementation makes use of get_sound() provided by other mixins. This
dependency is not explicit. I would expect to be able to say that
headphones_player depends on another mixing providing the get_sound message.
That's all for now.I will come back later when i will read more.
A BTW, the reference documentation doesn't contain the add<M>/get<M>