Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Archives:
Bug reports: FAQ:
Beginner's list: