Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-31 05:44:02


On Sun, 2008-08-31 at 01:58 -0500, Chris Knight wrote:
> > Do you mean that the FSM should never compile if it detects
> unexpected
> > events?
>
> Yes. If I say state_machine.process(Logon) when, for instance, the machine is
> in the Disconnected state I would expect that to be detected by default if
> for no other reason than the cost of doing so should be trivial/zero since
> the check is done at compile time. It could potentially matter with the
> addition of a post_event functionality as that would necessarily add the
> additional requirement of state machien variant checking in the machine's
> event double dispatcher that would process and dispatch posted base_events.

IMHO, this would add too much burden for the FSM designers, especially
in case of relatively big state machines with lots of events. They would
have to add handlers in every state (or a generic template handler in a
state base class) to explicitly process such events. Often users don't
need such strict explicity in event processing and can simply rely on
unexpected events handler (which could be used to post events for the
state machine through a third-party scheduler). Having a macro to enable
strict consistency check looks quite enough for me.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk