Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SCXML support #446

Open
faisal00813 opened this issue Jun 19, 2020 · 3 comments
Open

Add SCXML support #446

faisal00813 opened this issue Jun 19, 2020 · 3 comments

Comments

@faisal00813
Copy link

Finally, SCXML is now complete for adoption.
Adding support for SCXMl will allow standardisation.

@faisal00813
Copy link
Author

Some inspiration, https://github.com/davidkpiano/xstate

@aleneum
Copy link
Member

aleneum commented Jun 19, 2020

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 by transitions. A transitions 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 of ecmascript expression but I don't see something similar for transitions as evaluating strings as Python code or similar can caue a lot of damage. But afaik a datamodel other than None 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 as transitions

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) :).

@aleneum
Copy link
Member

aleneum commented Jun 22, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants