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 19626 - [XQ31] Awkward option declarations
Summary: [XQ31] Awkward option declarations
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: XQuery 3.1 (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: 2012-10-19 08:55 UTC by Tim Mills
Modified: 2014-04-22 15:43 UTC (History)
1 user (show)

See Also:


Attachments

Description Tim Mills 2012-10-19 08:55:29 UTC
Consider the following query.

import schema namespace s = "http://www.w3.org/XQueryTest/RequireProhibitF
eature";

declare function local:foo() as schema-element(s:foo) 
{
 ...
}

declare option prohibit-feature "schema-aware";

local:foo()


It is not until we are well into parsing that the option prohibiting use of import schema is encountered.  This is quite annoying.


Consider also a processor which has schema awareness disabled by default.

import schema namespace s = "http://www.w3.org/XQueryTest/RequireProhibitF
eature";

declare function local:foo() as schema-element(s:foo) 
{
 ...
}

declare option require-feature "schema-aware";

local:foo()

It is not until we are well into parsing that the option enabling use of import schema is encountered.  This is similarly annoying.
Comment 1 Michael Kay 2012-10-19 09:08:13 UTC
Another example of the same effect occurs when the higherOrderFunction feature is disabled after a function or variable declaration that makes use of it.

However, I'm inclined to live with it. In general, we allow forwards references; it's a hassle for implementors, but that's the job that implementors are paid for.
Comment 2 Tim Mills 2012-10-19 09:16:19 UTC
There's also a usability issue.  It's natural to write the require/prohibit before the feature is used - but this is grammatically incorrect.

Other examples include use of validate expressions in a function, or use of fn:serialize with serialization disabled.

That means it's awkward for every XQuery 3.0-defined feature except static typing.
Comment 3 Tim Mills 2012-10-19 11:02:05 UTC
Additionally, I don't find this construct particularly intuitive.

Without a detailed reading of the specification, I'd expect:

      declare option prohibit-feature "higher-order-function";
      declare option require-feature "all-optional-features";

either 

a) to complain that the higher-order-function feature is both prohibited and required (since higher-order-function is in the set of all optional features), OR
b) to disable the higher-order-function feature and then re-enable it.
Comment 4 Jonathan Robie 2012-10-29 15:51:26 UTC
The Working Group has decided not to change this in XQuery 3.0. Feel free to open this against 3.1 as a potential requirement.
Comment 5 Tim Mills 2012-10-30 09:54:16 UTC
Reopening as a potential change for XQuery 3.1.

I suggest something along the lines of

[6]    	Prolog 	   ::=    	
((DefaultNamespaceDecl | NamespaceDecl) Separator)* 
((OptionDecl) Separator)*
((DefaultNamespaceDecl | Setter | NamespaceDecl | Import) Separator)* 
((ContextItemDecl | AnnotatedDecl | OptionDecl) Separator)*

to permit option declarations to appear before schema/module imports.
Comment 6 Jonathan Robie 2014-04-22 15:43:01 UTC
We had no consensus to adopt this change.
Comment 7 Tim Mills 2014-04-22 15:43:24 UTC
Happy to close.