|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-05-23 11:12:50
"Andreas Huber" <ah2003_at_[hidden]> writes:
>> That seems like a bad limitation, and for me it calls into question
>> the idea of mapping state exit to destructors. Can you explain why
>> that's the right design?
>
> Yes, there's a lot of evidence that state exit actions must not fail:
>
> Say you have a state_machine<> subclass S and an object of that class, which
> currently resides in state A and state B nested in A (see the picture under
> Error handling in ratinale.html). Inside S::~S, the state machine is
> terminated what leads to the exit actions of B and A being executed. If B's
> exit action fails, what can you do with the resulting exception? I guess we
> agree that you cannot propagate it out of S::~S.
You miss my point. I know destructors must not fail. I am suggesting
that it may have been the wrong decision to represent state exit
actions with destructors; you could've used some other protocol.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk