From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 57551BCAC for ; Wed, 11 May 2005 19:19:41 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4BHJe5k014276 for ; Wed, 11 May 2005 19:19:40 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA10602 for ; Wed, 11 May 2005 19:19:40 +0200 (MET DST) Received: from us25.unix.fas.harvard.edu (us25.unix.fas.harvard.edu [140.247.35.201] (may be forged)) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j4BHJJH1014221 for ; Wed, 11 May 2005 19:19:40 +0200 Received: from [140.247.161.186] (roam161-186.student.harvard.edu [140.247.161.186]) by us25.unix.fas.harvard.edu (8.12.11/8.12.11) with ESMTP id j4BHIwYY016132; Wed, 11 May 2005 13:18:58 -0400 In-Reply-To: <4280FB1F.3050003@univ-savoie.fr> References: <20050506032256.10948.qmail@web90105.mail.scd.yahoo.com> <4280FB1F.3050003@univ-savoie.fr> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: Content-Transfer-Encoding: quoted-printable Cc: caml-list@inria.fr, Charles Martin From: Mike Hamburg Subject: Re: [Caml-list] unboxing options Date: Wed, 11 May 2005 13:18:57 -0400 To: Christophe Raffalli X-Mailer: Apple Mail (2.622) X-Miltered: at concorde with ID 42823EAC.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42823E97.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 unboxing:01 unboxed:01 interfacing:01 ocaml:01 unboxed:01 compiler:01 unboxing:01 christophe:01 raffalli:01 foo:01 mutable:01 foo:01 mutable:01 compiler:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Why should we need an "unboxed" keyword? Is there any reason why the=20 user should want things to be boxed? (Perhaps for interfacing with C?)=20= It seems to me that since a pure OCaml program would just be=20 specifying unboxed everywhere it could, the compiler could try to just=20= unbox everything it can. Assuming, that is, that changing the float=20 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 =3D { one : 'a option; mutable two : 'a >> option } >> >> would become: >> >> type 'a foo =3D { optional one : 'a; optional >> mutable two : 'a } >> > > You could also unbox any data type whose size is know at compile time=20= > in > a record if an "unboxed" keyword is present ... and remove the nasty=20= > 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=E9 de Savoie > Batiment Le Chablais, bureau 21 > 73376 Le Bourget-du-Lac Cedex > > t=E9l: (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 > ---------------------------------------------