Version française
Home     About     Download     Resources     Contact us    
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
<garrigue@kurims.kyoto-u.ac.jp> 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? 
i.e.:

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
describe?

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

John.

-------------------
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