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

RE: Run global <script> before or after <datamodel> initialization?

From: Jim Barnett <Jim.Barnett@genesyslab.com>
Date: Thu, 14 Feb 2013 21:47:58 +0000
To: Gavin Kistner <phrogz@me.com>, "www-voice@w3.org" <www-voice@w3.org>, "www-voice@w3.org" <www-voice@w3.org>
Message-ID: <57A15FAF9E58F841B2B1651FFE16D281020CA9@GENSJZMBX03.msg.int.genesyslab.com>
Gavin,
That's a bug in the pseudocode.  I'll fix it.  We used the word "scripts" because the <script> element may contain multiple scripts (at least in some scripting languages), but if that's confusing, we can change it.


-          Jim

From: Gavin Kistner [mailto:phrogz@me.com]
Sent: Thursday, February 14, 2013 4:43 PM
To: www-voice@w3.org; www-voice@w3.org
Subject: Run global <script> before or after <datamodel> initialization?

The prose in the official algorithm describes a <script> element at the root of the document as being run after the data model is initialized:

"Create an empty configuration complete with a new populated instance of the data model and a[sic] execute the global scripts[sic]."

(I assume that "scripts" should be "script", as only one <script> element may appear as a child of <scxml>.)

This order makes sense to me: I want my script to be able to read initial datamodel values and manipulate them. (I'm assuming that script executes in the context of the data model and may thus set values in it as well.)

However, the official pseudo-code executes the global script element before the data model is initialized:

    datamodel = new Datamodel(doc)
    executeGlobalScriptElements(doc)  # Note: this is also plural
    ...
    if binding == "early":
      initializeDatamodel(datamodel, doc)

Is there a compelling reason to execute global <script> before initializing the data model?
Received on Thursday, 14 February 2013 21:48:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 14 February 2013 21:48:31 GMT