English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2005-05-10 (18:19)
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
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
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 www.keyserver.net