ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> boost
boost
[boost] Re: [prereview request][fsm]
by Johan Nilsson other posts by this author
Jun 1 2004 7:34AM messages near this date
[boost] Re: [prereview request][fsm] | [boost] Re: [prereview request][fsm]
"Andreas Huber" <ah2003@[...].net>  wrote in message
news:c9aid2$g3g$1@[...]..
>  Robert Bell wrote:
>  >> Why else would you want to change the implementation (while leaving
>  >> the interface as is)?
>  >

[...]

>  >>> By using constructors and destructors for
>  >>> entry and exit, you're telling users that fsm guarantess that States
>  >>> will be constructed and destroyed at specific times, which means
>  >>> that
>  >>> for all time fsm must provide those guarantees.
>  >>
>  >> Yes, what's so bad about that? We'd have to guarantee the same with
>  >> entry() and exit().
>  >
>  > It strikes me that making that guarantee with entry() and exit() may
>  > be
>  > easier to maintain if the implementation changes.
> 
>  Only if I would see the slightest chance that such an implementation
change
>  will ever become necessary. To the contrary, entry() / exit() would
>  inevitably complicate the implementation and I'm not convinced that it has
>  any advantages whatsoever (performance or otherwise).
> 

As you referred me to this posting in another part of this thread; I'll
break in here:

- You asked why calling virtual functions in the context of the constructor
was necessary when the state must always be the most derived state: What
about the case when the most derived state also derives from a protocol
class? E.g. (rather contrived perhaps):

struct x_proto
{
    void do_x()
    {
        pre_x();
        in_x();
        post_x();
    }
private:
    virtual void pre_x() = 0;
    virtual void in_x() = 0;
    virtual void post_x() = 0;
};

struct x : fsm::simple_state<x, ...> , x_proto
{
    x() // aka 'entry'
    {
        x_proto::do_x(); // will probably work ok if we are fully
constructed before this call, but doesn't 'feel right'
    }

    virtual void pre_x() { ...}
    virtual void in_x() { ... }
    virtual void post_x() { ... }
};

- Is it possible to indicate that a state should exit right away in
boost::fsm (I'm not sure what this would be referred to as in FSM
terminology - a 'transitional state' perhaps)? E.g.:

struct flush_buffers : fsm::simple_state<...> 
{
    flush_buffers()
    {
        ... flush ...
        ... if ok - goto xxx_state
        ... if fail - return to previous
    }
};

This was just me trying to find some examples where the current design could
be limiting. What might (or might not) be the problem is that constructors
and destructors are special functions with special limitations and I'm not
so sure that entry/exit of states should be limited by this. Perhaps this
would change if the notion of a "state" in boost::fsm would change to a
"state_activation" (ref Topher Cooper's post).

Regards,

// Johan



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thread:
Andreas Huber
Andreas Huber
Andreas Huber
Darryl Green
Darryl Green
Darryl Green
Darryl Green
Andreas Huber
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
E. Gladyshev
Darryl Green
Andreas Huber
Johan Nilsson
Darryl Green
Andreas Huber
Andreas Huber
Rob Stewart
Andreas Huber
Rob Stewart
Johan Nilsson
Andreas Huber
Andreas Huber
Johan Nilsson
Johan Nilsson
Andreas Huber
Andreas Huber
Andreas Huber
Darryl Green
David Abrahams
Andreas Huber
Andreas Huber
Rob Stewart
Andreas Huber
Andreas Huber
Andreas Huber
Andreas Huber
David Abrahams
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
Darryl Green
David Bergman
David Abrahams
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
Andreas Huber
Andreas Huber
Andreas Huber
Darryl Green
Andreas Huber
Robert Bell
David Abrahams
E. Gladyshev
Johan Nilsson
Jeff Flinn
Johan Nilsson
Andreas Huber
Jeff Flinn
E. Gladyshev
Andreas Huber
Andreas Huber
Iain K. Hanson
Robert Bell
David Abrahams
E. Gladyshev
Andreas Huber
Andreas Huber
David B. Held
Andreas Huber
Johan Nilsson
Johan Nilsson
Peter Dimov
Johan Nilsson
Topher Cooper
Johan Nilsson
Johan Nilsson
Andreas Huber
Robert Bell
Andreas Huber
Andreas Huber
Andreas Huber
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
David Abrahams
Andreas Huber
E. Gladyshev
E. Gladyshev
Rob Stewart
E. Gladyshev
E. Gladyshev
Rob Stewart
E. Gladyshev
Rob Stewart
E. Gladyshev
Andreas Huber
Andreas Huber
E. Gladyshev
Marshall Clow
Marshall Clow
E. Gladyshev
David Abrahams
Darryl Green
E. Gladyshev
Andreas Huber
Andreas Huber
Robert Bell
Darryl Green
Pavel Vozenilek
David Abrahams
Andreas Huber
David Abrahams
Gregory Colvin
Pavel Vozenilek
Andreas Huber
Robert Bell
Andreas Huber
Johan Nilsson
Andreas Huber
Andreas Huber
Johan Nilsson
Johan Nilsson
Rob Stewart
Johan Nilsson
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
Andreas Huber
Johan Nilsson
Rob Stewart
Kwee Heong Tan
David Abrahams
Andreas Huber
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
Andreas Huber
David Abrahams
Andreas Huber
John Fuller
David Abrahams
David Abrahams
Andreas Huber
Andreas Huber
Aleksey Gurtovoy
David Abrahams
David Abrahams
David Abrahams
Andreas Huber
David Abrahams
David Abrahams

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved