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 Andreas Huber other posts by this author
May 30 2004 11:12PM messages near this date
Re: [boost] Re: [fsm] Why exit actions must not fail | [boost] Re: [fsm] Why exit actions must not fail
Darryl Green wrote:
>  A state is considered left (and hence is destructed) only after exit
>  and transition actions have run.
> 
>  That is, the previous state is destructed immediately before the new
>  state is constructed. For nested states, all exit actions would run,
>  followed by the transition action, followed by destruction of the
>  states being left, followed by construction of the new state(s).
> 
> > I don't see what that would buy you.
> 
>  Well it buys access to the state being left from the transition
>  action for a start.

Right, but I don't think it is justified to complicate the interface and the
implementation (we'd need to add entry()/exit()) for that. As I've explained
in my answer to your other post you can always move such a variables into an
outer context that exists during a transition.

>  In addition, if the exit action isn't the
>  destructor, and it fails, you are still in the original state. A
>  state specific recovery action is possible, using the state's own
>  context. The state destructor still must not fail.

A state-specific recovery function would make error handling much more
difficult, as you have no idea what you need to do to bring the state
machine back into a stable state. If you e.g. make a transition from such a
state, it is not guaranteed that the machine is stable afterwards (see
Exception handling in the tutorial).

>  My specific concern is the use of the extended functionality to
>  produce states which have/build significant context that (should)
>  only exist until a transition action deals with it. I don't see that
>  using this state context after the exit action has run is a problem.
>  The exit action may well have added to or modified it to make the
>  context complete, not damaged (and in particular not destructed) it.

That's true, see above.

>  I'm also concerned that the current fsm destruction/exit action
>  implementation model results in an environment where I should avoid
>  using exit actions that have any significant external effects because
>  I don't want/expect them to be run when/if the fsm is destructed.

Concern noted. This is actually the central disagreement between me and Dave
Abrahams. If you have any real-world examples, I'd be *very* interested to
see them.

>  Both the above concerns can be addressed by using custom reactions to
>  implement "pre-exit" actions when/if this turns out to be necessary.

Yes. It becomes a bit cumbersome when you have multiple transitions
originating at the state though.

>  I'll have to use the fsm library some more to see if this turns out
>  to be the case regularly enough to make it a significant use case.
> 
>  So, I now believe that the library has the necessary flexibility, and
>  only experience will tell how much and in what direction that
>  flexibility gets used/stretched. I'll keep you posted...

Please do!

Regards,

Andreas


_______________________________________________
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