| > The examples in your README also seem very limited Agreed. . > with no guards It's not entirely clear what you mean by a guard. Isn't the entirety of a state machine a guard? If you mean transitions that are disallowed due to embedded mealy values, that's meant to be handled by the return value from hooks. That runs but isn't published yet because the test cases aren't yet adequate . > actions const yeah_huh = sm`has_actions 'tell_em' -> neat;`;
or less glibly const matter = sm`
solid 'melt'
<-> 'freeze' liquid 'boil'
<-> 'condense' gas 'ionize'
<-> 'deionize' plasma;
`;
.> recursion State machines don't have control behavior and in general should not have direct expression of "recursion," unless I misunderstand what you mean If you mean machines self-embedding, that is planned, and I don't know of anyone else who does that . > parallelism Nothing stops you from putting a machine in each of a bunch of threads or web workers or whatever. By example, if you were making a Roller Coaster Tycoon style game, having one FSM to model each park visitor or each ride or each garbage pile or whatever would actually be fairly reasonable. Granted, I'd probably just make an array of them and process them serially in a single web worker, because you'd want the world synchronized and fast, but, it's doable. The core concept of a finite state machine has no direct association with process control and within a single finite state machine it's not actually clear to me what parallelism would mean within a single FSM. I've never seen this in any other state machine library. If this is what you mean, I'd like to hear more, possibly including an example API. It's possible that I misunderstand you. . > it seems overly simplistic as of now. If you can find a finite state machine with more features, please let me know where. |
Parallel states [1] are compound states with multiple distinct regions, where each region transitions separately. It does not necessarily imply threading on the programming side, it might just be multiple separate actors. Both PlantUML and XState support them.
XState: https://xstate.js.org/docs/guides/statenodes.html#state-node... PlantUML: https://plantuml.com/state-diagram
[1]: https://statecharts.github.io/glossary/parallel-state.html