Version française
Home     About     Download     Resources     Contact us    
Browse thread
Pervasives.compare output type
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alex Baretta <alex@b...>
Subject: Re: [Caml-list] Pervasives.compare output type
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.

Alex


-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>