English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 <malekith@pld-linux.org>
> 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 = Random.int ()
> 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 caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners