W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2003

[F&O] 15.3 Aggregate Functions

From: Dimitre Novatchev <dnovatchev@yahoo.com>
Date: Sat, 22 Nov 2003 07:23:20 -0800 (PST)
Message-ID: <20031122152320.94518.qmail@web41111.mail.yahoo.com>
To: public-qt-comments@w3.org

Allowing the functions fn:max, fn:min and fn:avg to accept an empty
sequence as argument is wrong and will make using these functions
difficult and confusing.

Trying to calculate the minimum, maximum or average of an empty sequence
is an error and must be reported at the place where this error occurs.

Returning the empty sequence instead is delaying the moment at which it is
realized that there is an error. This will lead to hidden, long-time
undiscovered errors and to difficulty in tracking the exact cause of an
error, as there has not been an immediate raising of an error as reaction
to the exact cause.

Why should the programmer be forced to manually include additional code to
check the type of the returned value and manually raise an error, if this
can be done automatically by the type-checking system?

Note: These comments apply to all cases in the WD, which allow an empty
sequence argument, for which the function has no meaning. In all such
cases the type of the function must be changed to accept a non-empty

It is necessary to analyze all cases where a fn:function is returning the
empty sequence and to decide case by case whether having such a result is

It is a benefit of typing that such errors can be caught (even sometimes
statically) and immediately reported in all cases.

Dimitre Novatchev

Do you Yahoo!?
Free Pop-Up Blocker - Get it now
Received on Saturday, 22 November 2003 10:23:32 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:15 UTC