RE: [F&O] IBM-FO-044: Errors in casting and constructors

This observation has also been made in:
 
http://lists.w3.org/Archives/Public/public-qt-comments/2004Feb/0154.html
 
Michael Kay


  _____  

From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org] On Behalf Of Don Chamberlin
Sent: 17 March 2004 00:58
To: public-qt-comments@w3.org
Cc: Andrew Eisenberg; Scott Boag; Henry Zongaro
Subject: [F&O] IBM-FO-044: Errors in casting and constructors



(IBM-FO-044): The F&O document, section 17 (Casting) says "Constructor
functions and cast expressions ... both convert a value to a given type with
identical semantics and different syntax."  The XQuery language document
agrees, in Section 3.12.5 (Constructor Functions): "The constructor function
for type T .... has exactly the same semantics as a cast expression with
target type T." 

But this equivalence does not seem to extend to error messages. 

(a) The language document, Section 3.12.3 (Cast) says that a Cast expression
can raise a type error (XQ0004 or XP0006), a dynamic error XQ0021 ("value
cannot be cast to the required type"), or a dynamic error XQ0029 ("value
does not satisfy facets of target type"). The language document does not
list any errors for constructor functions. 

(b) The F&O document, on the other hand, lists various casting-related error
messages with names like "error in casting to decimal", "error in casting to
integer", "invalid value for cast", etc. Some target types have specific
error messages, but most do not. It is generally not specified which errors
are dynamic and which are static. 

The language document and the F&O document are not consistent in their
handling of errors in casting, and it is not clear whether cast expressions
and constructor functions return the same error messages. This latter
property would be beneficial because it would allow implementations to
transform cast expressions into constructor functions. 

--Don Chamberlin

Received on Wednesday, 17 March 2004 06:05:35 UTC