Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Sorting
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <xavier.leroy@i...>
Subject: Re: [Caml-list] Sorting
> What are advantages and disadvantages in parametrizing either by '<'
> or by the 3-way comparison?

In addition to what has been said already, the 3-way comparison is
less error-prone with respect to two classic errors:
1- passing a "less than or equal" predicate where a "less than"
   predicate is expected, or conversely;
2- passing a predicate that is not a total ordering where a total
   ordering is expected.
Both errors could cause the old Sort.array or Sort.list functions to
misbehave seriously.  These errors are still possible with the 3-way
comparison approach, but less likely I think.

- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr