RE: [XQuery]&[F&O] fn:error: function parameters

Hello!
Thank you for attention to my request.
>From my point of view, making QName optional is satisfactory if you don't
want functions
to be overloaded by type of arguments, not by number of arguments only.
The only one I don't like is the message (error code) "Unidentified Error"
in the case of
omitted QName. From the XQuery programmer's point of view the error is often
identified
if he/she decided to call fn:error. So it's better to use something like
"User Error" or
similar. Consider the following example.


if (check_constraints(fn:doc("foo.xml")))
THEN do_something(doc("foo.xml"))
ELSE fn:error((), "Wrong type of input document")


err:FOE???? -- User Error
Wrong type of input document




P.S.
In general, I like the Michael's attitude to the problem, when the fn:error
understands
xs:string parameter and simply outputs the string given. But I understand
that it will
break the rule about overloading.

Best regards,
Andrey


-----Original Message-----
From: Ashok Malhotra [mailto:ashok.malhotra@oracle.com]
Sent: Wednesday, September 29, 2004 1:57 AM
To: Andrey Fomichev; public-qt-comments@w3.org
Subject: RE: [XQuery]&[F&O] fn:error: function parameters


Andrey:
The WGs discussed your request on the telcon today.  Since, as a rule, we do
not overload function
signatures we cannot have one signature for fn:error that takes a single
QName and another that takes
a single string.  So, we decided to change the third and fourth signatures
of fn:error and make the
QName optional.  In these two cases, if you pass the empty sequence as the
first (QName) argument
the function behaves as if you had passed the QName corresponding to
err:FOER0000 -- Unidentified Error.

Please let us know if this is satisfactory.

All the best, Ashok


-----Original Message-----
From: public-qt-comments-request@w3.org
[mailto:public-qt-comments-request@w3.org]On Behalf Of Andrey Fomichev
Sent: Friday, September 03, 2004 1:06 AM
To: public-qt-comments@w3.org
Subject: [XQuery]&[F&O] fn:error: function parameters



Hello!

According to F&O fn:error function must have the first parameter of
type xs:QName if it has any. For example, fn:error with only one
parameter has the following signature:

fn:error($error as xs:QName) as none

But '2.5.2 Handling Dynamic Errors' section of [XQuery] gives the
following example of using fn:error

fn:error(fn:concat("Unexpected value ", fn:string($v)))

So, fn:error is called with the value of type xs:string. Sometimes,
strings are castable to xs:QName, but it's not this case...

So, is it an error in specification?
As I think, providing function

fn:error($error as xs:string) as none

will be quite useful for various applications of XQuery.

Best regards,
Andrey

Received on Thursday, 30 September 2004 08:03:16 UTC