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
Polymorphic comparison
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1994-10-18 (09:43)
From: Pierre Weis <weis@p...>
Subject: Polymorphic comparison
To: caml-list@pauillac.inria.fr
Cc: John.Harrison@cl.cam.ac.uk
Subject: Polymorphic <<
Date: Mon, 17 Oct 94 16:10:57 +0100

Caml has a polymorphic equality with type scheme 'a -> 'a -> bool. It
tests structural equality between values of the same type
(isomorphism), and fails when applied to functions.

On the other hand comparisons are monomorphic: we have comparisons for
integers (prefix <=), strings (le_string), floatting point numbers
(le_float) but no polymorphic comparisons.
In the next 0.7 version of Caml Light, we plan to extend comparisons to a
polymorphic function (i.e. prefix < : 'a -> 'a -> bool, instead of the
now available prefix < : int -> int -> bool).

To extend comparisons to unrelated pairs of values, that is defining
prefix <  with type scheme 'a -> 'b -> bool seems a bit strange to me.
What do you plan to do with such a general type scheme for comparisons ?