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] Why must types be always defined at the top level?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-25 (10:20)
From: skaller <skaller@u...>
Subject: RE: [Caml-list] Why must types be always defined at the top level?
On Fri, 2004-06-25 at 05:46, John Hughes wrote:
> Thanks for the answers.  
> > > 1. Why no eqtypes? 
> > 
> > Eqtypes have been hotly debated even among the SML designers. 

Hmm .. but interesting Ocaml has a slot to marshal
abstract types .. and to finalise them .. but not
to compare them. Bignums in particular don't work
with polymorphic compare or hash, which means you can't
for example use them as keys to a hashtable .. as I just
discovered again :(

Any thoughts on a way to fix that?

My hashtable keys are terms which might contain
integers which happen to be represented by big ints,
so just using a custom hashtable won't work.

In this case, I'd be more than happy to just
hash the term's address (this would be heaps
faster than the recursive polymorphic comparison)

Is there a way to use an address as a comparable
but otherwise opaque value?

John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net

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