Boost logo

Boost :

From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2008-08-17 16:13:37


David Abrahams wrote:
> on Sun Aug 17 2008, Andrey Semashev <andrey.semashev-AT-gmail.com> wrote:
>
>> State machines, as I see it, are meant to define an object behavior,
>> IOW reduce the amount of undefined behavior. It is pointless to use
>> them to implement undefined behavior.
>
> So std::vector is pointless because it exhibits undefined behavior when
> misused?

No, vector is not pointless, because its purpose is to store elements,
not to define behavior. I will need vector to store elements even with
undefined behavior on invalid pointers as its input. But why would I
need FSM if it doesn't define my object's behavior? Or if I am adamant
on what particular input will come from the environment (IOW, the
behavior is already defined by the environment)?

>>> I find the code written using the proposed library rather procedural
>>> in nature (rather than declarative), thus the OP's comparison is very
>>> apt from my point-of-view. The hand-rolled code actually looks
>>> clearer and more direct to me.
>> Please, have a look at my reply to Phil. I've attached a code snippet
>> with a transition map. Does that look more declarative?
>
> Not really, to me. It's very difficult for me to see the transitions in
> that code. Compare that with either of my player examples.

Hmm... I don't see much difference, except for comments markup. Both
code samples use transition maps, both use vectors... Is it because the
transition map in your code is a member of the complete FSM?


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