<?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>7863</bug_id>
          
          <creation_ts>2009-10-09 21:28:20 +0000</creation_ts>
          <short_desc>[XQuery 1.1] BNF of FunctionDecl allows user-defined functions to be nondeterministic</short_desc>
          <delta_ts>2009-10-27 16:58:04 +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>XQuery 3.0</component>
          <version>Working drafts</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jim Melton">jim.melton</reporter>
          <assigned_to name="Jonathan Robie">jonathan.robie</assigned_to>
          
          
          <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>28181</commentid>
    <comment_count>0</comment_count>
    <who name="Jim Melton">jim.melton</who>
    <bug_when>2009-10-09 21:28:20 +0000</bug_when>
    <thetext>In the WD of XQuery 1.1 currently being prepared for internal WG review, EBNF production [31] reads:

FunctionDecl 	   ::=    	&quot;declare&quot; (&quot;deterministic&quot; | &quot;nondeterministic&quot;)? (&quot;private&quot; | &quot;public&quot;)? &quot;function&quot; QName &quot;(&quot; ParamList? &quot;)&quot; (&quot;as&quot; SequenceType)? (FunctionBody | &quot;external&quot;)

That syntax clearly allows: declare nondeterministic function X() external

However, the 6th paragraph of Section 4.17, Function Declaration, says: 

An XQuery processor can use static analysis to determine whether a user-defined function is deterministic (the syntax of function declarations does not allow a user-defined function to be declared deterministic or nondterministic).

(Note the typo: nondterministic.)

The parenthesized statement is clearly incorrect. It states (what my memory suggests is) the intent of the WG, but it is not on its face a correct observation. 

Assuming that is the WG&apos;s intent, then a way must be found to make the limitation normative. Two approaches come to mind: One would rewrite the EBNF to have two alternatives, one for user-defined functions and the other for external functions.  The other would have to define the limitation as a constraint, either by some sort of extra-grammatical constraint or by natural language in section 4.17.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29076</commentid>
    <comment_count>1</comment_count>
    <who name="Jonathan Robie">jonathan.robie</who>
    <bug_when>2009-10-27 16:58:04 +0000</bug_when>
    <thetext>In today&apos;s telcon, we agreed to add a rule to 4.17 - if a function is marked deterministic or nondeterministic, the function must be external; otherise,  it is a static error.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>