
On Mon, 11 Jul 2011 21:31:43 +0200 "Christophe Henry" <christophe.j.henry@googlemail.com> wrote:
The functor Not_ is suitable for "else". But if we have much more guards, We have to use Or_ functor like this. msme::Not_< msme::Or_< msme::Or_<Guard1, Guard2>, Guard3> >
Off the top of my head, how about the functor Else_ below? Else_ <Guard1, Guard2, Guard3, ... >
For else, we can use the fact that msm tries guards from the bottom of the table to the top:
// else clause Row< state1, ev, state2, none, none>, // if clause Row< state1, ev, state2, none, Or_<...> > // more if clauses ...
Fantastic! This has 2 advantages and 1 disadvantage. Advantages: One is simple enough. The other is good performance. It doesn't need evaluating the guard functor twice. I was about to consider how to cache the functor's result. Disadvantage: As you might expect, the evaluating direction is opposite of my intuition. Are there any reasons of this implementation? Modifying to the opposite direction is easy?
It's not UML-conform, but well ;-)
HTH,
Christophe
Regards, Takatoshi