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 29170 - [XQ31] Function and Variable Annotations
Summary: [XQ31] Function and Variable Annotations
Status: RESOLVED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.1 (show other bugs)
Version: Last Call drafts
Hardware: PC All
: 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: 2015-10-02 09:30 UTC by Michael Kay
Modified: 2015-10-20 21:01 UTC (History)
0 users

See Also:


Attachments

Description Michael Kay 2015-10-02 09:30:20 UTC
It would be useful for section 4.16 (Variable Declarations) and 4.18 (Function Declarations) to reference section 4.15 (Annotations) at some suitable point. Currently 4.16 and 4.18 contain incomplete information about annotations, and fail to point to the fact that 4.15 contains the full information, so the reader can easily get lost.

Note also:

* The list of reserved namespaces in 4.18 is badly formatted

* It would be a good idea to have the list of reserved namespaces in one place, rather than replicating it in 2.5.5.7, 4.15, 4.18, and in the decription of XQST0045
Comment 1 Michael Kay 2015-10-02 09:31:44 UTC
Also the description of XQST0045 says

"It is a static error if the name of a function annotation or the function name in a function declaration is in one of the following namespaces:"

but it also applies to variable annotations.
Comment 2 Michael Kay 2015-10-02 10:30:34 UTC
Furthermore:

(I) there seems to be confusion between annotations "defined by implementations" and "created by users". How are we to read:

"Implementations must not define annotations in the following reserved namespaces; it is an error for users to create annotations in the following reserved namespaces [err:XQST0045]:"

If I write

declare function %xsi:type local:f() {}

am I "creating an annotation" in the xsi namespace? There are test cases that suggest error XQST0045 is expected here, so that would seem to be the implication. The confusion is strongest in 2.5.5.7 where we read:

(a) Implementations may also provide a way for users to create their own function assertions.

(b) it is an error for users to create function assertions in the following reserved namespaces [err:XQST0045]:

In (a) "creating an assertion" seems to mean some kind of outside-the-spec mechanism for attaching a meaning to a particular QName used as an assertion, while in (b) "creating an assertion" seems to mean the use of a particular QName as an assertion in a FunctionTest.

(II) For function assertions (2.5.5.7), we read:

If a function assertion is not recognized by an implementation, it is ignored, and has no effect on the semantics of the function test.

while for annotations (4.15) we read:

If the namespace URI of an annotation's expanded QName is not recognized by the implementation, then the annotation is ignored.

Is the distinction deliberate? What happens in the latter case when the URI is recognized but the local name is not? And is the behaviour in this case different if the URI is reserved (i.e., does this constitute "creating an annotation")?

(These points seem to be more than purely editorial so I am raising the priority).
Comment 3 Jonathan Robie 2015-10-10 00:53:23 UTC
(In reply to Michael Kay from comment #1)
> Also the description of XQST0045 says
> 
> "It is a static error if the name of a function annotation or the function
> name in a function declaration is in one of the following namespaces:"
> 
> but it also applies to variable annotations.

I don't think we have said so in any of our prior drafts.  Ditto for variable names.  We could decide to, but this would be a technical change. I can make the change if the WG agrees, for now I'm not making this change.

Do we have test cases for this?  Probably be useful whichever way we decide.
Comment 4 Jonathan Robie 2015-10-10 01:22:05 UTC
(In reply to Michael Kay from comment #2)

I modified it so that the term "create" is never used for annotations. An implementation can provide a way for users to define annotations.

Defining an annotation is always an outside-the-spec mechanism, it is never simply using an existing annotation in a query. Ditto for defining an assertion.

> (II) For function assertions (2.5.5.7), we read:
> 
> If a function assertion is not recognized by an implementation, it is
> ignored, and has no effect on the semantics of the function test.
> 
> while for annotations (4.15) we read:
> 
> If the namespace URI of an annotation's expanded QName is not recognized by
> the implementation, then the annotation is ignored.
> 
> Is the distinction deliberate? What happens in the latter case when the URI
> is recognized but the local name is not? And is the behaviour in this case
> different if the URI is reserved (i.e., does this constitute "creating an
> annotation")?
> 
> (These points seem to be more than purely editorial so I am raising the
> priority).

In the telcon, we decided that an implementation ignores an annotation or assertion when the URI is not recognized, just as we do for pragmas.

You can see changes made for this bug by looking for "bug29170" in the XML.
Comment 5 Michael Kay 2015-10-10 09:28:55 UTC
Section 4.15 applies to both function and variable annotations and says

Implementations must not define annotations in the following reserved namespaces; it is an error for users to create annotations in the following reserved namespaces [err:XQST0045]:

It's only the summary description of XQST0045 that's wrong.