Closed lexuzieel closed 1 year ago
Hi @avixFF, internal transitions are standard state machine concepts, nothing specific to this library. From wikipedia:
Very commonly, an event causes only some internal actions to execute but does not lead to a change of state (state transition). In this case, all actions executed comprise the internal transition. For example, when one types on a keyboard, it responds by generating different character codes. However, unless the Caps Lock key is pressed, the state of the keyboard does not change (no state transition occurs). -- https://en.wikipedia.org/wiki/UML_state_machine#Internal_transitions
You have some examples in example_test.go:
Ah yes, I see. So in the context of this library does this mean that internal transitions is basically a way to define multiple independent events with different logic for the same state?
internal transitions is basically a way to define multiple independent events with different logic for the same state?
Yep, and those events don't trigger any state transition.
In the code there are mentions of "internal" transitions as well as of an "initial" transition which supposedly adds an internal transition to the machine. What is the purpose of this and how and when to use them? The README just tells how to define them in code without any examples on how to actually use them.