This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 8713 - [XQuery 1.0] Is "declare function element()" allowed?
Summary: [XQuery 1.0] Is "declare function element()" allowed?
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.0 (show other bugs)
Version: Working drafts
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Jonathan Robie
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-11 17:48 UTC by Michael Kay
Modified: 2010-02-16 19:40 UTC (History)
2 users (show)

See Also:


Attachments

Description Michael Kay 2010-01-11 17:48:59 UTC
Test case K2-NameTest-84 is, in essence:

declare default function namespace "http://www.example.com/";
declare namespace e =  "http://www.example.com/";
declare function element()
{
    1
};
e:element()

The expected result is that the test is successful. This hinges on whether "declare function element()" is an error on the grounds that the unprefixed function name "element" is disallowed.

The spec can be read in two ways here. The extra-grammatical constraint "reserved function names" (A1.2) states "Therefore it is not legal syntax for a user to invoke functions with unprefixed names which match any of the names in A.3 Reserved Function Names." This would imply that the syntax "element()" is reserved only as a function call, and not as a declaration. However, section A.3 states: "The following names are not allowed as function names in an unprefixed form because expression syntax takes precedence", which would make the above illegal. There's no particular reason to suppose that A.3 applies only to function calls.
Comment 1 Michael Dyck 2010-01-11 21:42:16 UTC
(This relates to Bug 7036.)
Comment 2 John Snelson 2010-02-09 12:13:47 UTC
Like Saxon, XQilla does not pass this test, but it would be simple to change that. I'm in favour of making reserved function names only applicable to function calls, since I believe that defining unprefixed module functions is a common pattern that we have no technical reason to restrict.
Comment 3 Jonathan Robie 2010-02-16 19:35:35 UTC
Today we agreed to change:

  "Therefore it is not legal syntax for a user to invoke functions
  with unprefixed names which match any of the names" 

to:

  "Therefore, an unprefixed function name must not be any of the names
  in A.3 Reserved Function Names"

This change will be made in XQuery 1.1. 

Our intent in 1.0 was to disallow such names in both function declarations and invocations. We will revise the 1.0 tests to allow either error or success.