W3C home > Mailing lists > Public > public-qt-comments@w3.org > May 2016

[Bug 29586] [XQ31] The judgement subtype-itemtype(Ai, Bi)

From: <bugzilla@jessica.w3.org>
Date: Tue, 10 May 2016 20:56:21 +0000
To: public-qt-comments@w3.org
Message-ID: <bug-29586-523-vZucKA7LcG@http.www.w3.org/Bugs/Public/>

--- Comment #14 from Michael Kay <mike@saxonica.com> ---
I think there's a general principle at stake here. I think we have made many
decisions over the years that suggest that we have consensus on this principle,
including some very recent decisions on test results. The principle is this:

Where the specification states that the result of an expression is of type X,
then it is acceptable for the implementation to return a value of type Y,
provided that subtype(Y, X) holds.

A consequence of this principle is that the result of the expression (V
instance of Y) is implementation-defined.

For example, when we say "the result of a value comparison is a boolean", then
this is shorthand for "the result R of a value comparison satisfies (R instance
of xs:boolean). We have nothing to say about whether or not R is an instance of
some other more specific type.

We have stated this principle clearly for the result of function calls (both
calls on user functions and calls on system functions). I don't believe that we
state clearly enough that it applies to all expressions. 

To take an example, if $H is a hat-size, then the specification requires only
that the result of +$H is an integer. Since a hat-size is an integer, it is
acceptable to return $H as the result of this expression. The result of the
expression (+$H instance of hat-size) is therefore implementation-defined.

The same principle applies to expressions that return functions. The
specification requires that the result of the expression (function() as
xs:decimal {2}) is of type (function() as xs:decimal). Since the type
(function() as xs:integer) is a subtype of this, it is therefore
implementation-defined whether or not the expression 

(function() as xs:decimal {2}) instance of function() as xs:integer

returns true or false.

Note that this is all about dynamic types; it has nothing to do with static

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Tuesday, 10 May 2016 20:56:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 10 May 2016 20:56:24 UTC