Bug #4497
closedWrong default type for tuple fields in the Saxon 10 documentation.
100%
Description
In the Saxon 10 documentation, it states that if an as
clause is absent then the type of that field is item()*
instead of item()+
. The current wording would (according to condition 2) permit the field to be absent (as it would allow the empty sequence).
The other parts of the documentation also mention that the fields are optional by default (e.g. the paragraph before the conditions).
The XQuery processor is behaving as if the fields are required (not optional) by default, as:
let $c as tuple(x, y) := map { "x": 2, "z": 3.5 }
return $c
gives the error:
[XPTY0004] The required item type of the value of variable $c is tuple(x: item()+, y: item()+); the supplied value map{"x":2,"z":3.5} does not match. Field y is absent; it must have a value
at test.xq:1:26
Updated by Michael Kay about 4 years ago
Yes, the design went through a number of iterations, but as implemented the default type is item()+ - the field is mandatory by default.
I'm thinking of a design change in future where optional fields have to be marked as such, and where "absent" and "empty" are distinguished in the type.
Updated by Michael Kay about 4 years ago
- Category set to Documentation
- Status changed from New to Resolved
- Assignee set to Michael Kay
- Priority changed from Low to Normal
- Applies to branch 10 added
- Fix Committed on Branch 10 added
Fixed the documentation in the development branch.
Updated by Debbie Lockett about 4 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
Marking closed, as 10 documentation has been updated online (XML and HTML versions).
Please register to edit this issue