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

RE: [F&O] 15.3 Aggregate Functions

From: Michael Rys <mrys@microsoft.com>
Date: Mon, 24 Nov 2003 10:30:11 -0800
Message-ID: <EB0A327048144442AFB15FCE18DC96C7015DA068@RED-MSG-31.redmond.corp.microsoft.com>
To: "Dimitre Novatchev" <dnovatchev@yahoo.com>, <public-qt-comments@w3.org>

Besides the explanation that Michael Kay gave, I have to take exception
at saying that aggregators should not be defined on empty sequence.

Many set-oriented languages define them. Some define them as propagating
the absence of values (i.e. SQL propagates NULL, the empty rowset), some
define them as returning the identity value of the underlying operation.
Either of them are useful definitions. Making the case an error would be
the wrong approach.

Best regards

> -----Original Message-----
> From: public-qt-comments-request@w3.org [mailto:public-qt-comments-
> request@w3.org] On Behalf Of Dimitre Novatchev
> Sent: Saturday, November 22, 2003 7:23 AM
> To: public-qt-comments@w3.org
> Subject: [F&O] 15.3 Aggregate Functions
> 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
> 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
> error, as there has not been an immediate raising of an error as
> 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
> can be done automatically by the type-checking system?
> Note: These comments apply to all cases in the WD, which allow an
> 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
> sequence.
> It is necessary to analyze all cases where a fn:function is returning
> empty sequence and to decide case by case whether having such a result
> meaningful.
> It is a benefit of typing that such errors can be caught (even
> statically) and immediately reported in all cases.
> Dimitre Novatchev
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
Received on Monday, 24 November 2003 13:30:13 UTC

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