[SCXML] Eventless transitions not selected after event?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[SCXML] Eventless transitions not selected after event?

Mike Mansell
I could easily be misunderstanding the SCXML specification, but it looks like that if you have (a tweaked example of my actual code):

<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" initial="start"> 


    <data id="data">{ "result": "unknown"}</data>


  <state id="start">

    <invoke id="lookup" type="data">

      <content expr="'blah'" />


        <assign location="data.result" expr="'found'" />



    <transition cond="data.result == 'found'" target="found" />


  <state id="found" />


Basically, you're issuing an invoke, and during it's finalize, you're updating some data model. The transition for that state is waiting until the data changes before moving to the next state.

The interesting part here is that the transition has no event. As far as I can understand the specification, specifically the section on mainEventLoop(), after an event (in this case the done.invoke.lookup) and after any event-based transition, the "event-less" transitions should be selected. However, the code in SCXMLSemanticsImpl, specifically the nextStep() only handles event-less code (via the macroStep()) if there was at least one transition that was selected by the event, which in this case, there is not.

It seems like a pretty simple fix, but I'm not 100% sure that I'm reading the spec right (I'm reasonably new to SCXML).