[Bug 3097] fn:Boolean should use error [err:XPTY0004].

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3097





------- Comment #2 from frans.englich@telia.com  2006-04-10 21:00 -------

Taking into the resolution of #2559, and assuming Rys' suggestion in this
report is accepted, the remaining usages of FORG0006 is in F&O, more
specifically the functions fn:avg(), fn:max(), fn:min() and fn:sum(), as far as
I can tell.

When FORG0006 is raised in those cases, it is as type errors. What
distinguishes the functions are their special typing rules; conversions that
are invoked, and that the sequence types of their arguments can't be expressed
with conventional sequence type syntax.

If an argument to a function not listed above, does not match as per sequence
type matching, XPTY0004 is raised(as per 3.1.5 Function Calls in XQuery, for
example). What makes the functions above special is that their typing rules are
not conventional, but it's still typing rules, especially from a user's
perspective, as I see it.

Phrased differently, if changing fn:boolean() to issue XPTY0004 instead of
FORG0006 due to "it would be more consistent with other type errors"(Rys), I
think one could apply the same reasoning to making the same change to the above
functions.

I think fn:boolean() is a more important and more central case than the
aggregation functions, but perhaps at least worth consideration. One can as
always balance the gain of the result against the other implications of
changing the specifications at this stage, but perhaps it's not so big if
fn:boolean() is to be changed anyway.


Regards,
Frans

Received on Monday, 10 April 2006 21:00:52 UTC