W3C home > Mailing lists > Public > www-voice@w3.org > April to June 2010

Re: April CCXML: test case conflicts with ECMA rules

From: Chris Davis <davisc@iivip.com>
Date: Fri, 23 Apr 2010 15:24:20 -0500
Message-ID: <4BD201F4.1010507@iivip.com>
To: www-voice@w3.org
CC: Petr Kuba <kuba@optimsys.cz>
Hello again Petr,

I assume your interpreter (OptimTalk) is exposing individual ECMA 
equivalent lines (except <script> blocks) from the CCXML document to its 
ECMA engine
one line at a time and that is how you manage to pass the test case. 
Your ECMA engine then has not seen the <var>
declaration when it begins executing <transition>, allowing you to pass 
the test case.

When you say:
"I don't see any statement in the CCXML specification that <var> usage 
implies declaration of the variable at the begging of <transtion>. "

the closest text seems to be here: 
http://www.w3.org/TR/2010/CR-ccxml-20100401/#Assign

where the Recommendation says "Variables with transition scope are 
declared by <var> and <script> child elements of <transition>. "
[ declaration seems to happen separately and prior to execution , like 
ECMA script itself ]

Then it describes what happens after  declaration:"The child <var> and 
<script> elements of <transition> are initialized in document order when 
the executable content is executed. "

When you say the following is illegal according to CCXML:

------------------------
    <transition event="ccxml.loaded">
      <assign name="x" expr="3"/>
      <var name="x"/>
    </transition>
-----------------------------
because of CCXML specification, Section 8.2.1.1:

  "It is illegal to make an assignment to a variable that has not been
  explicitly declared using <var> or a var statement within a <script>."
---------------------------
I must point out that you *did* declare a <var>. It's right there after 
the <assign>,
and it goes right into the <transition> scope during the declaration phase.

Our integration(SPOT) sees <assign> and turns that into "variablename 
semicolon" (with a few exceptions, like object/array references)
which will cause an ECMA error in the cases where there *is no <var> 
found in the scope chain*,which is
my interpretation of the CCXML rule.

Example:
  <assign name="x" expr="1"/>

is *not*
  x = 1; // this would declare/assign x if not found

but instead
x; // will cause ECMA error if ECMA can't find it
x=1;

Sure, we can get RJ Auburn's input.

Thanks for the lively discussion.

Regards,
Chris


Petr Kuba wrote:
> Hi Chris,
>
>> I don't see how any CCXML implementation can be passing this test case.
>> Is yours passing?
>
> Yes, OptimTalk passes this test smoothly.
>
>
> Your explanation below is correct but it is important to note that you 
> deal with a script. The following script in OptimTalk would behave the 
> same way as you describe:
>
>     <transition event="ccxml.loaded">
>       <var name="test"/>
>       <script>
>       [![CDATA[
>         test = id;
>
>         var id = 3;
>       ]]>
>       </script>
>     </transition>
>
> Here the test value would be 'undefined'.
>
> However, the test case deals with <var> tags. I assume that the <var> 
> tag is evaluated according to its position in a CCXML document. I 
> don't see any statement in the CCXML specification that <var> usage 
> implies declaration of the variable at the begging of <transtion>.
>
> I agree with you that it should be clarified whether the CCXML 
> interpreter behavior here should be the same as for ECMA Script. This 
> is probably issue for RJ Auburn.
>
> Anyway it is also important to consider consequences. For instance, 
> according to what you've described, this is correct code in ECMA script:
>
>     x = 3;
>     var x;
>
> So if we want to follow the same behavior in CCXML this should be also 
> correct:
>
>     <transition event="ccxml.loaded">
>       <assign name="x" expr="3"/>
>       <var name="x"/>
>     </transition>
>
> which probably breaks the following statement in the CCXML 
> specification, Section 8.2.1.1:
>
>   "It is illegal to make an assignment to a variable that has not been
>   explicitly declared using <var> or a var statement within a <script>."
>
> Regards,
> Petr
>


-- 
Chris Davis
Interact Incorporated R&D
512-502-9969x117
Received on Friday, 23 April 2010 20:24:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 23 April 2010 20:25:03 GMT