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
unboxing options
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <christophe.raffalli@u...>
Subject: Re: [Caml-list] unboxing options

>     type 'a foo = { one : 'a option; mutable two : 'a
> option }
> would become:
>     type 'a foo = { optional one : 'a; optional
> mutable two : 'a }

You could also unbox any data type whose size is know at compile time in
a record if an "unboxed" keyword is present ... and remove the nasty bit
of the compiler handling float in record.

{ unboxed float x; unboxed muatable float y }

You could imagine doing the same for array with a type ('a, 'b) array
where 'a is the type of the content and 'b is either `Boxed or `Unboxed
(using polymorphic variant)

but you still need a test for polymorphic function on array which need
to know if the array is unboxed and if yes what is the size of each
array cell.

I guess the code for this is not much more complex that the actual code
for float optimization, and is more general.

Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on