W3C home > Mailing lists > Public > www-voice@w3.org > January to March 2011

RE: SCXML: datamodel/script, the order of execution; late databinding behavior

From: Jim Barnett <Jim.Barnett@alcatel-lucent.com>
Date: Wed, 2 Mar 2011 10:48:07 -0800
Message-ID: <E17CAD772E76C742B645BD4DC602CD8103ECEF23@NAHALD.us.int.genesyslab.com>
To: "Johan Roxendal" <johan@roxendal.com>, <www-voice@w3.org>
Johan,

In response to your questions:

 

Q1:  In the case of early binding, data elements will have been assigned their initial values before the global script elements are executed.  This will be made clear in the next working draft.

Q2:  In the case of late binding, the value specified in the <data> element will be assigned when the containing state is first entered, even if the element has been assigned a non-null value in the interim.  Thus the <data> element will overwrite any value that was assigned by scripting.

 

-          Jim

 

From: www-voice-request@w3.org [mailto:www-voice-request@w3.org] On Behalf Of Johan Roxendal
Sent: Saturday, February 26, 2011 7:37 AM
To: www-voice@w3.org
Subject: SCXML: datamodel/script, the order of execution; late databinding behavior

 

according to the standard doc, the top-level datamodel element is evaluated at 'instantiation' time (http://www.w3.org/TR/scxml/#datamodel) and top-level script elements at 'document load time' (http://www.w3.org/TR/scxml/#script). from the interpret() function in the algorithm:

 

interpret(doc):

    ...

    datamodel = new Datamodel(doc)

    executeGlobalScriptElements(doc)

    ...

    startEventLoop()

 

 

I drew the conclusion that the datamodel is evaluated before the script elements are executed. in retrospect, the above code really only says that the datamodel is instantiated, not evaluated, before the script element. 

 

Q1:

Which is the correct evaluation order of top-level datamodel and script elements?

 

Q2:

In the snippet:

 

<scxml datamodel="ecmascript" binding="late">

    <state id="s1">

        <onentry>

            <log expr="data_slot" />

        </onentry>

    </state>

    <state id="s2">

        <datamodel>

            <data id="data_slot" expr="0" />

        </datamodel>

    </state>

</scxml>

 

the log in state s1 will throw error.execution. now, same document with a few additions:

 

<scxml datamodel="ecmascript" binding="late">

    <script>

        var data_slot;

    </script>

    <state id="s1">

        <onentry>

            <log expr="data_slot" />

        </onentry>

        <transition target="s2" />

    </state>

    <state id="s2">

        <datamodel>

            <data id="data_slot" expr="0" />

        </datamodel>

        <onentry>

            <log expr="data_slot" />

        </onentry>

    </state>

</scxml>

 

what will the second log statement print in this example? that is, does the data element overwrite the value of a slot that was given its initial value through the means of a script element?

 

thanks,

johan


					
-------------------------------------------------------------------------------------------------------------------
CONFIDENTIALITY NOTICE: This e-mail and any files attached may contain confidential and proprietary information of Alcatel-Lucent and/or its affiliated entities. Access by the intended recipient only is authorized. Any liability arising from any party acting, or refraining from acting, on any information contained in this e-mail is hereby excluded. If you are not the intended recipient, please notify the sender immediately, destroy the original transmission and its attachments and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Copyright in this e-mail and any attachments belongs to Alcatel-Lucent and/or its affiliated entities.
					
Received on Wednesday, 2 March 2011 18:50:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 2 March 2011 18:50:12 GMT