▲ | nurettin 9 hours ago | ||||||||||||||||
State machines don't have syntax for "transition here when event is encountered no matter what state you are in" so the whole diagram becomes a spaghetti mess if you have a lot of those escape hatches. | |||||||||||||||||
▲ | lelanthran 2 hours ago | parent | next [-] | ||||||||||||||||
> State machines don't have syntax for "transition here when event is encountered no matter what state you are in" so the whole diagram becomes a spaghetti mess if you have a lot of those escape hatches. I place a note at the top of my diagrams stating what the default state would be on receipt of an unexpected event. There is no such thing as "event silently gets swallowed because no transition exists", because, in implementation, the state machine `switch` statement always has a `default` clause which triggers all the alarm bells. Works very well in practice; I used to write hard real-time munitions control software for blowing shit up. Never had a problem. | |||||||||||||||||
| |||||||||||||||||
▲ | quietbritishjim 5 hours ago | parent | prev | next [-] | ||||||||||||||||
State machines don't have a native syntax in C++ at all, so you can structure them however you want. It's easy to structure a state machine, if needed, so that all (or some) states can handle the same event in the same way. | |||||||||||||||||
▲ | liontwist 3 hours ago | parent | prev | next [-] | ||||||||||||||||
goto is exactly this feature. | |||||||||||||||||
▲ | a_t48 9 hours ago | parent | prev [-] | ||||||||||||||||
I believe HSMs can model this, but don't quote me. :) | |||||||||||||||||
|