clj-statecharts
clj-statecharts copied to clipboard
support for :type :final state
would be good to know if the process is done. Currently just :parallel is supported as :type in the Schema + would be good to not to allow signals after :final state has reached.
https://xstate.js.org/docs/guides/final.html#api
I'm always curious about the "final state" feature. Could you name a typical use case for that in real world applications?
Sure.
in real life: I've used FSMs to model long-running processes (with both users and applications sending signals to them), with state stored in a database. These processes need to have start and end after which, after end, special bookkeeping is done (compliancy, reporting + hitting filter "done").
Simple case not from real world:
- there are two end states:
:cancelled(unhappy) and:closed(happy). After reaching either, the machine doesn't accept any more signals. - it's not enough not to put any transitions into the "final" state as there can be top-level signals that should not be accepted anymore, sample https://stately.ai/viz/5ed2fa0c-a585-4695-b6b9-c81789274756