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 5651 - [FS] Static typing rules for fn:boolean.
Summary: [FS] Static typing rules for fn:boolean.
Status: CLOSED FIXED
Alias: None
Product: XPath / XQuery / XSLT
Classification: Unclassified
Component: Formal Semantics 1.0 (show other bugs)
Version: Candidate Recommendation
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: Michael Dyck
QA Contact: Mailing list for public feedback on specs from XSL and XML Query WGs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-22 12:29 UTC by Oliver Hallam
Modified: 2008-08-18 07:20 UTC (History)
0 users

See Also:


Attachments

Description Oliver Hallam 2008-04-22 12:29:17 UTC
FS 7.2.4 gives static typing rules for fn:boolean.  Surely these typing rules should be applied to fn:not too?
Comment 1 Oliver Hallam 2008-04-22 13:13:30 UTC
The definition for fn:boolean (in F&O 15.1.1) says:
If $arg is a sequence whose first item is a node, fn:boolean returns true.

However the static typing rules reject any sequence of more than one items that is not a sequence of nodes.

And so fn:boolean applied to the sequence type (xs:node(), xs:integer) fails to type check despite the fact that every value of this type gives the result true().

Should the definition of fn:boolean be changed to read "If $arg is a sequence of one or more nodes, fn:boolean returns true"?
Comment 2 Michael Kay 2008-04-22 13:25:00 UTC
>Should the definition of fn:boolean be changed to read "If $arg is a sequence
of one or more nodes, fn:boolean returns true"?

No, absolutely not. This would mean that a dynamic implementatation would have to read the whole sequence, perhaps containing a million nodes, before it can establish that there are no atomic values in the sequence and it can therefore return true.
Comment 3 Michael Dyck 2008-04-24 20:43:19 UTC
(In reply to comment #0)
> FS 7.2.4 gives static typing rules for fn:boolean.  Surely these typing rules
> should be applied to fn:not too?

Yes, I think they should, since fn:not makes an implicit call to fn:boolean, which can raise a type error. I propose that we tweak the rule in FS 7.2.4 to handle fn:not as well.
Comment 4 Michael Dyck 2008-04-29 18:46:19 UTC
At its meeting today, the WGs approved the proposal of comment #3 (addressing the original comment #0), so this will be reflected in an FS erratum at some point.

If you wish to pursue the matter you brought up in comment #1, please raise it as a separate bug, against F+O.

Consequently, I'm marking this issue resolved-FIXED. If you agree with this resolution, please mark it CLOSED.

Comment 5 Michael Dyck 2008-08-18 07:20:01 UTC
This issue has been entered as FS erratum E027, and its fix has been
committed to the source files for the next edition of the FS document.
Consequently, I'm marking this issue CLOSED.