[Bug 3085] fn:boolean: FS, F&O and XQuery contradict

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3085





------- Comment #2 from mike@saxonica.com  2006-04-05 14:37 -------
I believe that the spec is the way it is by design.

For systems doing dynamic type-checking, it is not reasonable to expect them,
given an expression such as <xsl:if test="//item">, to read the whole input
sequence in order to check that all the items are nodes. They can return true
as soon as they have found that the sequence contains at least one item and
that item is a node. 

For systems doing static type-checking, it's reasonable to allow them to treat
a heterogeneous sequence as an error, so that they can treat the boolean()
function effectively as polymorphic: they can decide statically which of four
different boolean() methods is being used.

This means that there are some cases that will work (return a result) with a
dynamic typing implementation that fail (return an error) with a static typing
implementation, but that's a normal state of affairs. The most common such
cases are not those involving sequences that are actually heterogeneous, but
those where the static type permits heterogeneity - and users of static type
systems will be very familiar with such error messages.

Michael Kay
http://www.saxonica.com/
personal response

Received on Wednesday, 5 April 2006 14:37:32 UTC