<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>30017</bug_id>
          
          <creation_ts>2016-11-20 15:39:08 +0000</creation_ts>
          <short_desc>UpdatingFunctionCall use of PrimaryExpr makes the grammar ambiguous.</short_desc>
          <delta_ts>2017-01-10 17:30:56 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XPath / XQuery / XSLT</product>
          <component>Update 3.0</component>
          <version>Last Call drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Reece H. Dunn">msclrhd</reporter>
          <assigned_to name="John Snelson">john.snelson</assigned_to>
          <cc>jmdyck</cc>
          
          <qa_contact name="Mailing list for public feedback on specs from XSL and XML Query WGs">public-qt-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>128235</commentid>
    <comment_count>0</comment_count>
    <who name="Reece H. Dunn">msclrhd</who>
    <bug_when>2016-11-20 15:39:08 +0000</bug_when>
    <thetext>UpdatingFunctionCall is defined in Update Facility 3.0 as:

    [207] UpdatingFunctionCall ::= &quot;invoke&quot; &quot;updating&quot; PrimaryExpr &quot;(&quot; (ExprSingle (&quot;,&quot; ExprSingle)*)? &quot;)&quot;

However, PrimaryExpr contains FunctionCall. This means that for:

    invoke updating test()

&apos;test()&apos; will be interpreted as FunctionCall. That is:

    UpdatingFunctionCall: &apos;invoke updating&apos;
        PrimaryExpr/FunctionCall: &apos;test()&apos;
        [error]: missing token &apos;(&apos;

It also does not make sense for this to be an OrderedExpr or Constructor (which are valid according to the grammar).

It would make more sense to define this similar to the XQuery 3.1 ArrowFunctionSpecifier:

    [127] ArrowFunctionSpecifier ::= EQName | VarRef | ParenthesizedExpr

For example:

    UpdatingFunctionCall ::= &quot;invoke&quot; &quot;updating&quot; UpdatingFunctionCallSpecifier &quot;(&quot; (ExprSingle (&quot;,&quot; ExprSingle)*)? &quot;)&quot;
    UpdatingFunctionCallSpecifier ::= EQName | VarRef | ParenthesizedExpr</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128238</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2016-11-21 03:46:23 +0000</bug_when>
    <thetext>(In reply to Reece H. Dunn from comment #0)
&gt; UpdatingFunctionCall is defined in Update Facility 3.0 as:
&gt; 
&gt;     [207] UpdatingFunctionCall ::= &quot;invoke&quot; &quot;updating&quot; PrimaryExpr &quot;(&quot;
&gt; (ExprSingle (&quot;,&quot; ExprSingle)*)? &quot;)&quot;
&gt; 
&gt; However, PrimaryExpr contains FunctionCall. This means that for:
&gt; 
&gt;     invoke updating test()
&gt; 
&gt; &apos;test()&apos; will be interpreted as FunctionCall. That is:
&gt; 
&gt;     UpdatingFunctionCall: &apos;invoke updating&apos;
&gt;         PrimaryExpr/FunctionCall: &apos;test()&apos;
&gt;         [error]: missing token &apos;(&apos;

Yes, that looks like the correct behaviour to me. What do you think is ambiguous?


&gt; It also does not make sense for this to be an OrderedExpr or Constructor
&gt; (which are valid according to the grammar).

(Note to others: &quot;this&quot; = &quot;the PrimaryExpr of an UpdatingFunctionCall&quot;.)

E.g., if you used a Constructor there, you&apos;d get a type error. But it&apos;s not the grammar&apos;s job to only derive type-safe queries.  


&gt; It would make more sense to define this similar to the XQuery 3.1
&gt; ArrowFunctionSpecifier:
&gt; 
&gt;     [127] ArrowFunctionSpecifier ::= EQName | VarRef | ParenthesizedExpr
&gt; 
&gt; For example:
&gt; 
&gt;     UpdatingFunctionCall ::= &quot;invoke&quot; &quot;updating&quot;
&gt;       UpdatingFunctionCallSpecifier &quot;(&quot; (ExprSingle (&quot;,&quot; ExprSingle)*)? &quot;)&quot;
&gt;     UpdatingFunctionCallSpecifier ::= EQName | VarRef | ParenthesizedExpr

It&apos;s possible that might make more sense to some people. But note that UpdatingFunctionCall is fairly explicitly modelled after XQuery&apos;s DynamicFunctionCall, which also uses a PrimaryExpr to specify the function to be invoked.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128239</commentid>
    <comment_count>2</comment_count>
    <who name="Reece H. Dunn">msclrhd</who>
    <bug_when>2016-11-21 07:11:40 +0000</bug_when>
    <thetext>(In reply to Michael Dyck from comment #1)
&gt; (In reply to Reece H. Dunn from comment #0)
&gt; &gt; It would make more sense to define this similar to the XQuery 3.1
&gt; &gt; ArrowFunctionSpecifier:
&gt; &gt; 
&gt; &gt;     [127] ArrowFunctionSpecifier ::= EQName | VarRef | ParenthesizedExpr
&gt; &gt; 
&gt; &gt; For example:
&gt; &gt; 
&gt; &gt;     UpdatingFunctionCall ::= &quot;invoke&quot; &quot;updating&quot;
&gt; &gt;       UpdatingFunctionCallSpecifier &quot;(&quot; (ExprSingle (&quot;,&quot; ExprSingle)*)? &quot;)&quot;
&gt; &gt;     UpdatingFunctionCallSpecifier ::= EQName | VarRef | ParenthesizedExpr
&gt; 
&gt; It&apos;s possible that might make more sense to some people. But note that
&gt; UpdatingFunctionCall is fairly explicitly modelled after XQuery&apos;s
&gt; DynamicFunctionCall, which also uses a PrimaryExpr to specify the function
&gt; to be invoked.

Thanks for the clarification. I was thinking of things like:

    invoke updating fn:put(...)

However, if I understand correctly, the &apos;invoke updating&apos; here is not needed as fn:put has the updating annotation (and any other updating function).

Likewise, it would be an error to use `$f(...)` if `$f` references an updating function -- &apos;invoke updating&apos; should be used here -- and `invoke updating $f(...)` would be an error if `$f` does not reference an updating function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128250</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2016-11-21 20:24:26 +0000</bug_when>
    <thetext>(In reply to Reece H. Dunn from comment #2)
&gt;
&gt; Thanks for the clarification. I was thinking of things like:
&gt; 
&gt;     invoke updating fn:put(...)
&gt; 
&gt; However, if I understand correctly, the &apos;invoke updating&apos; here is not needed
&gt; as fn:put has the updating annotation (and any other updating function).

Right, a FunctionCall can reference a simple function or updating function, making it a simple expression or updating expression respectively.
 
&gt; Likewise, it would be an error to use `$f(...)` if `$f` references an
&gt; updating function -- &apos;invoke updating&apos; should be used here --

That true if none of the args is &quot;?&quot;: &quot;If the function returned by the PrimaryExpr [of a dynamic function invocation] is an updating function, and the dynamic function invocation is not a partial function application, a dynamic error is raised [err:XUDY0038].&quot;

&gt; and `invoke updating $f(...)` would be an error if `$f` does not
&gt; reference an updating function.

No, a dynamic updating function call &quot;can invoke either an updating function or a simple function&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128353</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Dyck">jmdyck</who>
    <bug_when>2017-01-10 17:30:56 +0000</bug_when>
    <thetext>The Working Group decided today to close this bug as &quot;Works For Me&quot;.
Please reopen if there are unresolved matters.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>