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
RE: [Caml-list] User-defined equality on types?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-04-19 (21:01)
From: Don Syme <dsyme@m...>
Subject: RE: [Caml-list] User-defined equality on types?
> On Wed, 18 Apr 2001, John R Harrison wrote:
> > I'd like to suggest allowing the user to define a chosen 
> interpretation
> > of the equality symbol, and perhaps the polymorphic 
> orderings too, on
> > each new (maybe just abstract) data type. This seems natural in the 
> > context of abstract data types with non-canonical 
> representation, giving
> > a kind of quotient type. 
> [snip]
> > Any opinions?
> I support this suggestion. The standard equality/ordering/hashing
> functions are often adequate for most of the data structures, 
> and it would
> be useful to use them and just place a hook on specific types 
> to provide
> specialized implementation. It could almost be done with
> the "custom" block tag; the problem is that such blocks are 
> not garbage
> collected.  What about "custom Caml blocks" ?

I support the suggestion too.  In general I'm not a big fan of types
carrying much implicit functionality, but I like the "balance" that Caml
has struck by making hashing, equality, ordering and marshalling
available for all types.  And given that you can define these functions
for custom blocks, it cetainly makes sense to be able to define them for
types defined in Caml as well...

To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr