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 (02:01)
From: Jacques GARRIGUE <garrigue@k...>
Subject: Re: [Caml-list] Unboxing options, was RE: assertions or exceptions?
From: John Prevost <>

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

Now that you tell it, Xavier's idea (and implementation) was actually
along this line.
The trouble is that it doesn't change the cost: you just do an and on
the lower bits rather than on the higher ones.
Might be worth retrying some day, as hardware is changing, but I don't
expect any real change.

Jacques Garrigue

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