Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread output type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-03-31 (06:32)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] output type
On Wed, Mar 30, 2005 at 04:45:27PM +0200, Alex Baretta wrote:
> Xavier Leroy wrote:
> >It's a historical error.  If I were to do it again, I'd use a sum type
> >such as your "comparison_result".  The current solution allows to use
> >(-) (integer subtraction) as the comparison predicate for *small*
> >integer arguments, but this doesn't work as a general integer
> >comparison because of subtraction wrapping around for large arguments.
> >So, there are really no benefits to encode the result of a 3-way
> >comparison as an "int".
> >
> >- Xavier Leroy
> Whether fixing such historical errors engenders more benefits than 
> trouble is a very interesting philosophical question.

Well, there are implementations of modules with and without
named parameters, why not providing different implementations
for compare?

Or maybe additionnally to "compare" provide a function
"comparison" or "comp" or something like that?

Is it sooooooo necessary to have only this one "compare"
function? Is it too much overhead in the interface to
add a function that uses sum-types?

Maybe commenting "compare" with an attribute like "do not use
in future developments" or so?!