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: -- (:)
From: John Prevost <j.prevost@g...>
Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions?
On Fri, 16 Jul 2004 09:35:17 +0900 (JST), Jacques GARRIGUE
<> wrote:
> 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? 

None = ...0010 (2)
Some None =  ...0110 (6)
Some Some None = ...1010 (10)
Some Some Some None = ...1110 (14)

and so on?  This would remove the need to use a special memory area
(or check that area) for wrapping and unwrapping.  There'd still be a
cost, but I would think it should be smaller than the cost you

That said, I also don't think this is a critical issue.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: