Are targetless transitions on an ancestor always preempted?

I still, disturbingly, struggle to gain intuition on  section 3.13 of the spec. Please help me by clarifying:

    <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0">
      <state id="innerwrap">
        <transition event="foo"><log label="Should I run?"/></transition>
        <state id="A"><transition event="foo" target="B" type="internal"/></state>
        <state id="B"/>
      </state>
    </scxml>

My intuition tells me that a "foo" event should be ‘consumed’ by the inner transition and not ‘bubble’ out. That the outer log message should not run.

[Q1] Is this correct?

It is, I think, confirmed by this text: "Definition: A transition T is optimally enabled by event E in atomic state S if a) T is enabled by E in S and b) no transition that precedes T in document order in T's source state is enabled by E in S and c) no transition is enabled by E in S in any descendant of T's source state."

Part (c) prevents the targetless transition above from executing. Yes?

Now, what about parallel?

    <scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0">
      <parallel id="outerwrap">
        <transition event="foo"><log label="Should I run?"/></transition>
        <state id="inner1">
          <state id="A1"><transition event="foo" target="B1" type="internal"/></state>
          <state id="B1"/>
        </state>
        <state id="inner2">
          <state id="A2"><transition event="foo" target="B2" type="internal"/></state>
          <state id="B2"/>
        </state>
      </parallel>
    </scxml>

[Q2] If "foo" occurs, should the log message occur?

The same spec above seems to tell me that it should not, as long as the transitions in inner1 or inner2 are present. Even if the transition in inner2 was not present, the fact that any child of the parallel was enabled by it means that the outer targetless transition is preempted per (c).

And finally, for good measure:

[Q3] If "foo" occurs, should both B1 and B2 be entered?

My intuition tells me yes, because that's what parallel is all about, yo. I think this is supported because part (b) of the above quoted definition does not apply. One transition precedes the other in document order, but they are not part of the same hierarchy when we consider the source state of each transition. Correct?

Thanks for your help. :)


Received on Wednesday, 29 October 2014 14:51:38 UTC