Le 08/02/2016 20:32, Kris a écrit :
On Sat, Feb 6, 2016 at 10:34 PM, Vicente Botet [via Boost] < ml-node+s2283326n4683294h33@n4.nabble.com> wrote:
src + event [guard]/action = dst // guard throws runtime_error src + exception
= X // handle exception Yes, this is the idea. Great. I have improved error handling if it comes to exceptions. Right now, if you do NOT compile with `-fno-exceptions` and do not specify configure noexcept then you can handle any exceptions thrown on the transition table.
make_transition_table( *"idle"_s + "event1"_t / [] { throw std::runtime_error{"error"}; } , "idle"_s + "event2"_t / [] { throw 0; }
, *"error_handling"_s + exceptionstd::runtime_error / [] { std::cout << "exception caught" << std::endl; } , "error_handling"_s + exception<> / [] { std::cout << "generic exception caught, terminate..." << std::endl; } = X ); I missed the syntax for the orthogonal regions. It is not very explicit. The idea to have an orthogonal section that does the error handling is good, but how would you do error recovery?
I don't think you should correlate whether MSM manage exceptions and whether the configure function is noexcept. When you say " When guard/action throws an exception State Machine http://boost-experimental.github.io/msm-lite/user_guide/index.html##sm-state... will stay in a current state.", do you mean that if there is an exception in the action part, the state will be the nesting state of the transition, as the exit of the source state will already be executed? If yes, this is not a leaf state, this is why I added a pseudo-state, to ensure a leaf state.
You can handle specific type of the exception(exception<type>) or just any(exception<>). What would be the event associated to the action in this cases?
Okay, well, msm-lite doesn't support that as a feature. However, you can achieve more or less all of mentioned things just by using C++. For example, you can extend transiton table of a state machine by joining it with another one.
auto table1 = make_transition_table(transitions...); auto table2 = make_transition_table(table1, other_transitions...);
This should respond to point 1*. 2* should need to replace the refined state in table1. Point 3 would covered if the make_transition_table function overrides the redefined transitions.
I was wondering whether your point with extending transitions can't be achieved using sub machines instead ? This is another mechanism of extension that of course should work also, but that is not related to the previous 5 extensions mechanisms
It would be great if you show how the user can address these points with your library using some run-able concrete examples.
Yea, I will work on that. Cheers for the pointers.
Thanks for working on this. Vicente