This appendix lists the changes that have been made to this specification since the publication of the XQuery 3.1 Recommendation.
The following changes have been agreed by the working group:
Function definitions in the static context may now have optional parameters, provided this does not cause ambiguity across multiple function definitions with the same name. Optional parameters are given a default value, which can be any expression, including one that depends on the context of the caller (so an argument can default to the context item).
In a static function call, arguments can be specified either positionally or using keywords, or a combination of both.
The rules for "errors and optimization" have been tightened up to disallow
many cases of optimizations that alter error behavior. In particular
there are restrictions on reordering the operands of and
and or
,
and of predicates in filter expressions, in a way that might allow the processor to raise dynamic
errors that the author intended to prevent.
The following changes are present in this draft, but are awaiting review and agreement:
The static context now allows the default namespace for elements and the default namespace for types to be different. XSLT 4.0 takes advantage of this, XQuery 4.0 currently does not.
A new with
expression allows namespace bindings to be defined
within an expression (and to be redefined in nested expressions).
The static context now allows the unprefixed function names to be resolved using an arbitrary algorithm, rather than requiring the resolution to use a default namespace.
The rules for reporting type errors during static analysis have been changed
so that a processor has more freedom to report errors in respect of constructs that
are evidently wrong, such as @price/@value
, even though dynamic evaluation
is defined to return an empty sequence rather than an error.
Record types are added as a new kind of ItemType
, constraining
the value space of maps.
Local union types are added as a new kind of ItemType
, constraining
the value space of atomic values.
Enumeration types are added as a new kind of ItemType
, constraining
the value space of strings.
Element and attribute tests of the form element(N)
and attribute(N)
now allow N
to be any NameTest
,
including a wildcard.
The "function conversion rules" are now renamed "coercion rules".
The coercion rules allow "relabeling" of a supplied atomic value where
the required type is a derived atomic type: for example, it is now permitted to supply
the value 3 when calling a function that expects an instance of xs:positiveInteger
.
New abbreviated syntax is introduced for simple inline functions.
The lookup operator "?" can now be followed by a string literal, for cases where map keys are strings other than NCNames.
An otherwise
operator is introduced: A otherwise B
returns the
value of A
, unless it is an empty sequence, in which case it returns the value of B
.
A ternary conditional expression (A ?? B !! C
) is introduced.
The arrow operator =>
is now complemented by a "thin arrow" operator ->
which applies a function to each item in the input sequence independently.
The rules for value comparisons when comparing values of different types (for example, decimal and double) have changed to be transitive. A decimal value is no longer converted to double, instead the double is converted to a decimal without loss of precision. This may affect compatibility in edge cases involving comparison of values that are numerically very close.
A for member
clause is added to FLWOR expressions to allow iteration over
an array.
Mathematical operator symbols are available as alternatives to alphabetic operator names, for example
div
can be written as รท
, while intersect
can be written as .
The presentation of the rules for the subtype relationship between sequence types and item types has been substantially rewritten to improve clarity; no change to the semantics is intended.
The operator mapping table has been simplified by removing entries for the operators ne
,
le
, gt
, and ge
; these are now defined by reference to the
rules for the operators eq
and lt
.