by goless · 1y ago · 0 comments
As for why semantic composition is used, the following example may be instructive:
yes_or_no(exit,a) This means confirm once before exiting
yes_or_no(yes_or_no(exit,a),a) Confirm twice before exiting
yes_or_no(yes_or_no(yes_or_no(exit,a),a),a) Confirm three times before exiting
This is very similar to the composition you describe.
This is the actual code: https://github.com/sdzx-1/polystate-examples/blob/fecaffb5b7...
If there is no name for this way of using state machines, then semantic composition seems appropriate.
Exceptionally, combining two states in a polystate may actually be combining two small state machines, and I think nested selects are sufficient to illustrate this.
https://github.com/sdzx-1/ray-game/blob/9646bc3c0f1c11314aaf...
How do you understand such behavior?
This is the state diagram combining two selects!