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] assertions or exceptions?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-07-16 (16:40)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions?
> > The idea is just to reserve a sufficiently large memory area to
> > represent every needed (Some (Some ...(Some None) ...)).
> Apologies for keeping the conversation going, but since I just
> thought of this:
> Caml's internal pointers are at minimum 4-byte aligned.  What about
> using the other "safe" set of trailing bits, "10", to mark options? 
> i.e.:
> None = ...0010 (2)
> Some None =  ...0110 (6)

This is very tempting indeed, but the Caml heap compactor already uses 
the ...10 encoding to temporarily mark some data during compaction.

As Jacques said, we've toyed with the idea of encoding option types
specially for quite a while, and even prototyped it at some point, but
never got convinced that it was really important to do so.

Someone asked whether "option option" types occur in "real life".
One occurrence was sighted in the sources of an old version of Coq.
I haven't checked if it is still there.

- Xavier Leroy

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