Project

Profile

Help

Bug #4497

closed

Wrong default type for tuple fields in the Saxon 10 documentation.

Added by Reece Dunn about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Documentation
Sprint/Milestone:
-
Start date:
2020-03-24
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
10
Fixed in Maintenance Release:
Platforms:

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
Actions #1

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.

Actions #2

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.

Actions #3

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

Also available in: Atom PDF