clj-statecharts icon indicating copy to clipboard operation
clj-statecharts copied to clipboard

support for :type :final state

Open ikitommi opened this issue 3 years ago • 2 comments

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

ikitommi avatar Apr 13 '22 09:04 ikitommi

I'm always curious about the "final state" feature. Could you name a typical use case for that in real world applications?

lucywang000 avatar Apr 18 '22 10:04 lucywang000

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

ikitommi avatar Apr 18 '22 18:04 ikitommi