W3C home > Mailing lists > Public > public-qt-comments@w3.org > March 2004

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

From: Don Chamberlin <chamberl@almaden.ibm.com>
Date: Tue, 16 Mar 2004 16:57:39 -0800
To: public-qt-comments@w3.org
Cc: Andrew Eisenberg <andrew.eisenberg@us.ibm.com>, Scott Boag <scott_boag@us.ibm.com>, Henry Zongaro <zongaro@ca.ibm.com>
Message-ID: <OF6B93062C.2F9A5BBC-ON88256E5A.0002CBF3-88256E5A.00053F11@us.ibm.com>
(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 Tuesday, 16 March 2004 19:58:14 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:13:56 UTC