string compared to integer

Does the expression
    "3" > 1
yield an error, or the value true, or what?

In the Formal Semantics, section 4.5 Operators indicates (in the second
rule) that the expression type-checks. (It has the type xs:boolean.) But
section 5.4 Operators has no rule that would allow us to infer its value.
Presumably this is just an oversight, and the authors meant to include a
rule that basically punted the semantics to the F&O spec (as it does with
many other operators). But the F&O spec doesn't appear to define the
expression's semantics, since a string can't be promoted to an arithmetic
type. So that suggests that expression yields an error.

However, some of the examples in the main XML Query spec and the Use Cases
spec appear to assume implicit coercion of strings to numbers in this sort
of context.

-Michael Dyck

Received on Saturday, 24 November 2001 17:42:41 UTC