RE: DN-FO-18: Empty sequence should not be allowed as argument to max(), min(), and avg()

--- "Kay, Michael" <Michael.Kay@softwareag.com> wrote:
> > 
> > The functions max(), min(), and avg() are defined to accept a 
> > first argument of type:
> > 
> >       xdt:anyAtomicType*
> > 
> > On the other side, asking for the maximum, minimum or the 
> > average of an empty sequence clearly doesn't make sense. 
> > Other programming languages also require that the argument of 
> > max should be a non-empty list (e.g. Haskell's prelude.hs)
> > 
> > The type of the first argument of these functions must be:
> > 
> >       xdt:anyAtomicType+
> > 
> 
> We debated whether to do this, and decided that min() and max() of an
> empty
> sequence should return () rather than being an error. This is consistent
> with the general approach to handling of (), and is easier on the user
> given
> that we have no try/catch capability to make errors non-fatal.

Trying to find the max(), min() or avg() of an empty sequence is a very
significant logical error that must be corrected by the programmer -- it
should be a fatal error.

Such a decision does not solve any problem. It creates new problems.

See for example other comments in this list:

http://lists.w3.org/Archives/Public/public-qt-comments/2003Oct/0064.html




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com

Received on Saturday, 11 October 2003 10:16:45 UTC