Re: [SCXML] history state in parallel state

On 15-7-2015 10:51, David Junger wrote:
>>> <scxml>
>>> <parallel id="p">
>>>      <history id="h">
>>>          <transition target="a2"/>
>>>      </history>
>>>      <state id="a">
>>>          <state id="a1"/>
>>>          <state id="a2"/>
>>>      </state>
>>> </parallel>
>>> </scxml>
>>>
>
>> Ah, thanks! So, in the example above, targeting it explicitly would mean
>> setting the initial state of the scxml to the history state?
>
> I'm not sure what you mean. The initial *configuration* of the document would resolve histories to real states. Remember, there can be no pseudo-states in a configuration. If you did this:
>
> <scxml initial="h">
>
> and added a type="deep" attribute to your <history> (otherwise it can only target immediate siblings)
>
> then the initial configuration would be resolved to (p -> a -> a2) because the history's parent has never been exited, so it has no historical record, so the history's default transition is used instead.
>
> I'm not sure what the behavior should be if you don't specify type="deep". Invalid document? resolve to state 'a' because that's the sibling ancestor of 'a2'?
>
> Note that transitions inside <history> and <initial> are not triggered like normal transitions. Following them does not constitute a microstep. Instead, they resolve (reccursively) to their real targets as if the targets had been the original targets all along.

Sorry, I should have added type="deep". I know that transitions in 
<history> and <initial> get resolved. The question was how to trigger 
the transition in a <history> state, which you answered. Thanks!

So, now for my understanding: why do history states need to be targeted 
explicitly? Why not always target them implicitly?

-- Erik.

Received on Wednesday, 15 July 2015 09:22:11 UTC