-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Hierarchical State Machines #31
Comments
This would be an awesome extension! |
Some proposals for hierarchical syntax.
statemachine! {
transitions: {
*Off + TurnOn = On.Continutous,
On.Continuous + RunBurst = On.Burst.On,
On.Burst.On + BurstOff = On.Burst.Off,
On.Burst.Off + BurstOn = On.Burst.On,
On.Burst + RunCont = On.Continuous,
On + TurnOff = Off
},
} Advantages: Disadvantages:
statemachine! {
transitions: {
*Off + TurnOn = On,
On + TurnOff = Off,
On {
*Continuous + RunBurst = Burst,
Burst + RunCont = Continuous,
Burst {
*On + BurstOff = Off,
Off + BurstOn = On,
},
},
},
} Advantages: Disadvantages: |
[Boost::ext].SML calls this composite state machines (I guess a term from UML): https://boost-ext.github.io/sml/examples.html#composite. They are defined as separate state machines and used as state in the parent state machine. Events bubble from leaves to trunk until they find a transition. Sub-state machines can optionally re-enter the most recent state they were in (history). |
Thanks @corecode, I'll take a look at this and be consistent with the behavior as long as it makes sense for Rust environments. |
I think that hierarchical state machines could be implemented quite elegantly with this framework by using state data which is simply another state machine. Right now, it would be on the user to handle the hierarchical event processing code, and to define and stitch together the state machines. I think first class support though would mean:
The text was updated successfully, but these errors were encountered: