Version française
Home     About     Download     Resources     Contact us    
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: Mike Hamburg <hamburg@f...>
Subject: Re: [Caml-list] unboxing options
Why should we need an "unboxed" keyword?  Is there any reason why the 
user should want things to be boxed?  (Perhaps for interfacing with C?) 
  It seems to me that since a pure OCaml program would just be 
specifying unboxed everywhere it could, the compiler could try to just 
unbox everything it can.  Assuming, that is, that changing the float 
unboxing code to unbox other stuff is actually fairly easy.

Mike

On May 10, 2005, at 2:19 PM, Christophe Raffalli wrote:

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