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

Johan,

Those are good questions.  We will discuss them in the group and get back to you.

 

-          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 Sunday, 27 February 2011 16:19:06 UTC