RE: [XQuery] static typing of node comparisons

> Actually the spec writer did not get it wrong. They decided to write the
> queries to work with dynamic semantics and not necessarily with the
> static semantics. The reason is that the static semantics is defined in
> the formal semantics spec. 

Ah yes returning to the original comment:-)

I considered that as a possibility before my original post but rejected
it as being improbable and a bad choice if it really was deliberate.
I may not like it but as currently written the static typing rules are
a formal (if optional) part of the language (whichever document they get
defined in) the example code is given and states conditions under which
it will error, including reference to a code for a static error, those
conditions are incorrect if the static typing option is being used and
the text should say that.

> The functions that take double are taking double mainly because of
> XPath 1.0 backwards-compatibility.

yes and no. Xpath1 only had one numeric type. Xpath2 has lots,
The functions could have been typed with their natural type
(integer  or even positiveinteger arguments) and still retained
operational compatibility with xpath1 if the Xpath2 type inference made
these types in any way usable, however it doesn't. If these functions
are given their natural signatures they are unusable without users using
explicit casts on the arguments to every function call. So in F&O you
have tried to dodge the issue by fudging the signatures to get usable
behaviour. This isn't really related to Xpath1 compatibility, as I said
every Xpath2 user is going to have to quickly learn to use very general
types or double (to use numeric type promotion) to avoid the draconian
static typing rules.

David

Received on Tuesday, 2 December 2003 19:28:34 UTC