transitions
transitions copied to clipboard
Add SCXML support
Finally, SCXML is now complete for adoption. Adding support for SCXMl will allow standardisation.
Some inspiration, https://github.com/davidkpiano/xstate
Hi @faisal00813,
Adding support for SCXML will allow standardisation.
If you are looking for a python engine capable of working with SCXML, you could have a look at PySCXML. It's not maintained anylonger but maybe it is sufficient for your purposes.
About the 'standardisation': With my current knowledge I would say that it is not possible for transitions
to be SCXML-compatible:
-
transition
's callbacks in general are hard to translate - this could be compensated by definining a custom event type - transition callbacks such as
prepare
,before
,after
,finalize
are not supported by SCXML and I dont see how this can be compensated - SCXML's transition execution time
between
states is not supported bytransitions
. Atransitions
model is never 'between states'. - SCXML does not support 'negated' conditions like
unless
- it could be replaced with 'not condition' maybe -
transitions
has no<history>
state - this could be a state extension maybe -
transitions
does not support datamodels - SCXML expects for instance the evaluation ofecmascript
expression but I don't see something similar fortransitions
as evaluating strings as Python code or similar can caue a lot of damage. But afaik a datamodel other thanNone
is not a must. -
transition
does not support a transition without a trigger/event - those could be dropped when parsing though - SCXML's
invoke
and communication with other services is (imho) out of scope for a 'simple' state machine such astransitions
Some inspiration, https://github.com/davidkpiano/xstate
It's a great state chart library for sure. But I could not find documentation about how SCXML can be imported or exported. Can you provide a link or Codepen/JSFiddle?
So, long story short: transitions
and SCXML are designed significantly different. Is it possible to create an export/import system for a simple state machine without most transition callbacks, configuration capabilities and a very limited set of 'Executable content'? Probably. Will transitions
support a majority of SCXML features? Probably not. Can transitions
export/import xstate
SCXML exports? I don't know (yet) :).
That being said, I do think it is possible to build an SCXML engine based on transitions
and add all the web technology the w3c likes to see in an SCXML implementation. This could be part of the pytransitions organisation but would be an individual module/package.