Boost logo

Proto :

Subject: Re: [proto] Using Phoenix inside eUML: mixing grammars
From: Michael Caisse (boost_at_[hidden])
Date: 2011-03-20 16:31:33


On 03/16/2011 01:56 PM, Christophe Henry wrote:
> Hi,
>
> I have my eUML grammar, defing, for example a transition as:
>
>

<snip first question that I don't have an answer for>

> Second question. Now it's becoming more "interesting". And not easy to
> explain :(
>
> For eUML, a guard can be defined as "g1&& g2", where g1 and g2 are
> functors, taking 4 arguments. For example (to make short):
> struct g1_
> {
> template<class FSM,class EVT,class SourceState,class TargetState>
> void operator()(EVT const& ,FSM&,SourceState& ,TargetState& )
> {
> ...
> }
> };
> g1_ g1;
>
> The fact that there are 4 arguments is the condition to make this work
> without placeholders.
>
> I 'm pretty sure that, while this clearly should be a function for
> phoenix, I would not like the syntax:
> g1(arg1,arg2,arg3,arg4)&& g2(arg1,arg2,arg3,arg4).
>

Placeholders would be great here. I find most of the time I only care
about EVT or EVT and FSM. Having MSM defined placeholders with cool
names like evt_ and fsm_ wouldn't be bad IMHO.

Also... shouldn't operator() return a bool for a guard? Then this just
becomes a composition. If g1 and g2 are phoenix functions then (making
up some new MSM placeholders):

          g1(evt_) && g2(evt_,fsm_)

    will result in the composed lazy functors and placeholders are now
your friends.

This also allows me to write full phoenix lambdas inline with the eUML
which would be the cat's meow!

I like the way these discussions are going Christophe!

michael

-- 
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.com

Proto list run by eric at boostpro.com