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
[Caml-list] Strange physical equality behavior
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-11-11 (01:35)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] Strange physical equality behavior
From: Michal Moskal <>
> On Mon, Nov 10, 2003 at 05:29:24PM +0900, Jacques Garrigue wrote:
> > The last solution is not to bother about that: I'm yet to see code
> > mixing two sets of the same type but with different comparison
> > functions. Sounds silly.
> For me it doesn't. You cannot prevent user from shooting his foot in
> this case. For example consider:
>   let cmp x y = ()
> This is very good comparision functions, and can also be used with
> functiorial interface. You may say it is silly, but random functions 
> (that are not total orderings) can be created by accident (for example
> by comparing some mutable member or what's not).

Looks like you are supporting my point.
I was just saying that I'm yet to see somebody trying to take the
union of two sets defined with different (supposedly correct)
comparison functions.
And you point out a much more probable danger, which cannot be
prevented neither by the type system or dynamic checks.
So using the type system (or dynamic checks) to prevent an unprobable
risk, while there are much more probable ones, seems an overkill.

But I won't go more in that direction: as a type freak, preventing any
risk is good.

     Jacques Garrigue

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: