From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA13775 for caml-redistribution; Sun, 10 Oct 1999 22:31:22 +0200 (MET DST) 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 WAA06087 for ; Sun, 10 Oct 1999 22:30:55 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id WAA15096 for ; Sun, 10 Oct 1999 22:30:52 +0200 (MET DST) Resent-From: Pierre.Weis@inria.fr Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA23066 for caml-list@inria.fr; Sun, 10 Oct 1999 22:30:51 +0200 (MET DST) Resent-Message-Id: <199910102030.WAA23066@pauillac.inria.fr> Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA21461 for ; Sun, 10 Oct 1999 14:24:29 +0200 (MET DST) Received: from enst.enst.fr (enst.enst.fr [137.194.2.16]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id OAA21603 for ; Sun, 10 Oct 1999 14:24:28 +0200 (MET DST) Received: from Montchapet.ecole (root@cal-ppp22.ppp.enst.fr [137.194.3.22]) by enst.enst.fr (8.9.1a/8.9.1) with ESMTP id OAA07283 for ; Sun, 10 Oct 1999 14:24:27 +0200 (MET DST) Received: from localhost (localhost [[UNIX: localhost]]) by Montchapet.ecole (8.9.3/8.9.3) id OAA16310 for Pierre.Weis@inria.fr; Sun, 10 Oct 1999 14:23:03 GMT From: Michel Quercia Reply-To: quercia@cal.enst.fr To: Pierre Weis Subject: Re: Data structures in ocaml Date: Sun, 10 Oct 1999 12:56:15 +0000 X-Mailer: KMail [version 1.0.17] Content-Type: text/plain References: <199910092352.BAA00909@pauillac.inria.fr> MIME-Version: 1.0 Message-Id: <99101014230201.15999@Montchapet> Content-Transfer-Encoding: 8bit Content-Transfer-Encoding: 8bit Resent-Date: Sun, 10 Oct 1999 22:30:51 +0200 Resent-To: caml-list@inria.fr Sender: weis Le sam, 09 oct 1999, vous avez écrit : : For instance: : : -- (any : int) was 0 : -- (any : string) was "" : ... : -- (any : t) where t was a sum type was the first constant constuctor if : any ot the first functional constructor C of ty with (any : ty) as : argument. (Hence (any : string list) was [].) : -- (any : t) where t was a record type was the list of field with the : value (any : ty) in each field (ty according to the label argument).-- (any : t1 -> t2) was (fun _ -> raise Bottom) : : This is well-typed and semantically sound. What about : "type t = T of int*t" (immutable circular int lists) ? Well there is a solution : "let rec dummy = T(0,dummy)" but in more complicated recursive type definitions the compiler will have to work hard to produce some plausible value, it seems to me that this should always be possible, am I right ? Concerning varying arrays, -------------------------- I had an idea not far from Markus Mottl's own. Define a new tag, let's call it Vtag flagging varying size (that is both growing and shrinking) objects. A Vobject would say : "Hello everybody, I'm a varying size object, I have TWO lengths, an allocation length stored in my header and an actual length stored in my first field. And you can pretty trust in me, the actual length never greater that the allocation one will be. Mr. GC, would be so kind as to not put your nose past my actual length ? There is nothing interresting for you there. Mr. compiler, please check index bounds against my actual length, and shift actual index by one in order to retrieve the indexed value." Now the need for uninitialized values disappears as well as the need to erase pointers when shrinking a Varray ... Nice, but I have some doubts about O'caml implementors accepting my proposal. Concerning Lists implemented by varying arrays, ----------------------------------------------- An awfull question pops up inside of me, how can one implement : let l1 = a :: l and l2 = b :: l if lists are actually arrays (with head at the end) without copying l ? -- Michel Quercia 9/11 rue du grand rabbin Haguenauer, 54000 Nancy http://pauillac.inria.fr/~quercia mailto:quercia@cal.enst.fr