Hacker News new | ask | show | jobs
by goless 358 days ago
Haha, thanks for your reply, I will improve my documentation to make the descriptions more accurate, and you may raise some issues to help this library better.

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?

1 comments

https://github.com/sdzx-1/polystate/raw/master/data/graph.pn...

This is the state diagram combining two selects!

Due to my submission yesterday, this diagram can no longer fully accurately express the current state machine, but it can probably be used as an approximate reference.