- From: Jim Barnett <Jim.Barnett@genesyslab.com>
- Date: Wed, 13 Feb 2013 15:55:19 +0000
- To: Gavin Kistner <phrogz@me.com>, "www-voice@w3.org" <www-voice@w3.org>
Gavin,
I think that you're right. I'm working on an overhaul of enterStates that fixes this and other issues (I hope).
- Jim
-----Original Message-----
From: Gavin Kistner [mailto:phrogz@me.com]
Sent: Tuesday, February 12, 2013 9:46 PM
To: www-voice@w3.org
Subject: Adding history states with recorded history
I believe that this pseudo-code from the top oc addStatesToEnter() is incorrect:
if isHistoryState(state):
if historyValue[state.id]:
for s in historyValue[state.id]:
addStatesToEnter(s,statesToEnter,statesForDefaultEntry)
for anc in getProperAncestors(s,state):
statesToEnter.add(anc)
Specifically, the second-to-last line. The proper ancestors of the states recorded by a <history> will never include the <history> itself (noted by "state" above), and so the line is equivalent to calling `getProperAncestors(s,null)`. Consequently, every ancestor of a recorded node is added to the entry set, *including the root <scxml> node itself*.
Here's a simple example machine:
<scxml xmlns="http://www.w3.org/2005/07/scxml" version="1.0" name="HistoryTest">
<initial><transition target="universe">
<raise event="modal.on" />
<raise event="modal.off" />
</transition></initial>
<state id="universe">
<transition event="modal.on" target="modal" />
<state id="s1" />
<history id="h"><transition target="s1"/></history>
</state>
<state id="modal"><transition event="modal.off" target="h"/></state>
</scxml>
The machine enters 'universe/s1', then exits these states (recording 's1' in the history for 'h') and enters 'modal'. When the machine processes the 'modal.off' event, enterStates() calls addStatesToEnter(), passing along the <history> node.
I believe that the second-to-last line in the quoted code above should perhaps instead read:
for anc in getProperAncestors(s,state.parent):
Received on Wednesday, 13 February 2013 15:55:49 UTC