This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
XQuery 3.1 does not yet define updated conformance criteria. Currently XQ 3.0 makes higher order functions an optional feature. Functions as values are not supported if this optional feature is not supported. Maps and arrays are functions, but for maps in particular, I don't think we should make support optional: there are too many dependencies on maps in standard functions. I think it's possible to define our conformance packages so higher order functions remain optional, but maps and arrays become part of minimal conformance. But we need to think about how to achieve this. For example, do we want to support the SequenceType function(*) for an item that could be a map or an array?
I would like higher order functions to remain an optional feature. I think an implementation that supports maps and arrays but not higher order functions should still be able support AnyFunctionTest and TypedFunctionTest in sequence type matching.
Note that if maps, arrays, and JSON are core features and higher order functions are optional, then it becomes impossible to invoke the "fallback" option of parse-json, json-doc, and json-to-xml.
With respect to FNO, if an implementation supports maps and arrays but not higher order functions, I think it should be able to partially support the following functions: fn:parse-json/fn:json-doc/fn:json-to-xml (except for fallback) fn:sort/array:sort (with one argument) But it would not support: fn:apply fn:function-lookup fn:function-name fn:function-arity fn:for-each fn:filter fn:fold-left fn:fold-right fn:for-each-pair fn:load-xquery-module map:for-each array:for-each array:filter array:fold-left array:fold-right array:for-each-pair
Just looked at the XQuery 3.0 test suite results here: http://dev.w3.org/2011/QT3-test-suite/ReportingResults/spec/XQ30.html Looks like every vendor that reported results had support for higher order functions, the worst of these had 122/126. Perhaps the simplest thing is to make higher order functions a mandatory feature? I don't know of a serious implementation of XQuery 3.0 that does not support them.
For Saxonica, higher order functions are a chargeable option. We would like to keep it that way; we believe the facility is high value and worth paying extra for.
At meeting #530, the working group decided that higher order functions would remain optional: https://lists.w3.org/Archives/Member/w3c-xsl-query/2013Feb/0030.html I would also like to keep this decision.
OK, two vendors have said "don't go there", I withdraw the suggestion.
Good topic for the face-to-face.
This text in 5.2.6 will need to be adjusted: "An implementation that does not provide the Higher-Order Function Feature MUST raise a static error [err:XQST0129] if it encounters a FunctionTest, dynamic function call, named function reference, inline function expression, or partial function application. Such an implementation MAY raise a type error [err:XPTY0004] if an expression evaluates to a sequence that contains a function." Implementations that support maps and arrays but not higher-order functions should not be required to raise XQST0129 for function tests or dynamic function calls.
DECISION: Accepted new text for section 5.2.6 Higher-Order Functions Feature: "An implementation that does not provide the Higher-Order Function Feature MUST raise a static error [err:XQST0129] if it encounters a TypedFunctionTest, named function reference, inline function expression, or partial function application.". Also add an explanatory note: "The effect of this rule is that it is impossible to construct function items other than maps and arrays. Dynamic function calls are permitted, but the function that is called will necessarily be a map or array. The syntax function(*) is permitted to represent a type that allows maps and arrays, and every instance of this type will in practice be either a map or an array."
DECISION: Add a tag to F&O for functions only provided in the "Higher-Order Functions" feature. fn:parse-json() and fn:json-doc() are not in the feature. The extended argument versions of fn:sort() and fn:array-sort() are in the feature. Other functions that take or return functions (that are not maps and arrays) are in the feature. fn:load-xquery-module() is in the feature. The XQuery 3.1 spec should say "any use of a function with this tag will result in [err:XPST0017].
The F+O part of this action is DONE. For example, fn:sort now has the "Properties" section: Properties The one-argument form of this function is ·deterministic·, ·context-independent·, and ·focus-independent·. The two-argument form of this function is ·deterministic·, ·context-independent·, ·focus-independent·, and ·higher-order·.
The XQuery part of this action is also DONE.