[Bug 10880] New: [XQuery11] Should %deterministic and %nondeterministic be hints?

http://www.w3.org/Bugs/Public/show_bug.cgi?id=10880

           Summary: [XQuery11] Should %deterministic and %nondeterministic
                    be hints?
           Product: XPath / XQuery / XSLT
           Version: Member-only Editors Drafts
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XQuery 1.1
        AssignedTo: jonathan.robie@redhat.com
        ReportedBy: oliver@cbcl.co.uk
         QAContact: public-qt-comments@w3.org
             Group: XSLXQuery_WG


Section 4.18 states:

A function declaration may use function annotations to specify that an external
function is %deterministic (which is the default) or %nondeterministic.
[Definition: A deterministic function is a function that always evaluates to
the same result if it is invoked with the same arguments.] [Definition: A
nondeterministic function is a function that is not guaranteed to always return
the same result when it is invoked with the same arguments.]. It is a static
error [err:XQST0106] if a function's annotations contain more than one
annotation named %deterministic or %nondeterministic. 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 nondeterministic).

This paragraph seems to confuse the annotations %deterministic and
%deterministic with the properties deterministic and non-deterministic.  It
also implies that these annotations cannot be used with user-defined functions,
although I am not sure that is the case (no error is specified - I assume they
just have no effect).

I think it is too strong to say the annotations define whether a function is
deterministic or not - the implementation may have more information about this.
 I propose that these annotations should only be hints to the processor.  The
current specification says that if no annotation is specified then the function
IS deterministic - what if the implementation knows it definitely isn't?

I also suggest that the hint could apply to user-defined functions as well as
external functions, for example:

declare %deterministic local:function($a, $b)
{
  (# eg:script language=c#
  public static int Function(int a, int b)
  {
    return a + b;
  }
  #) { () }
}


I would suggest rewriting this paragraph as so:

[Definition: A deterministic function is a function that always evaluates to
the same result if it is invoked with the same arguments.] [Definition: A
nondeterministic function is a function that is not guaranteed to always return
the same result when it is invoked with the same arguments.].  An XQuery
processor can use static analysis to determine whether a user-defined function
is deterministic or non-deterministic.  The annotations %deterministic and
%nondeterministic can be used as a hint to the processor to allow it to
determine whether an function is deterministic or non-deterministic.  It is a
static error [err:XQST0106] if a function's annotations contain more than one
annotation named %deterministic or %nondeterministic.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 30 September 2010 17:45:56 UTC