Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Michel Quercia <quercia@cal.enst.fr>
To: Pierre Weis <Pierre.Weis@inria.fr>
Subject: Re: Data structures in ocaml
Date: Sun, 10 Oct 1999 12:56:15 +0000	[thread overview]
Message-ID: <99101014230201.15999@Montchapet> (raw)
In-Reply-To: <199910092352.BAA00909@pauillac.inria.fr>

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




  parent reply	other threads:[~1999-10-10 20:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-10-06 18:50 skaller
1999-10-07 12:10 ` Pierre Weis
1999-10-08 18:05   ` skaller
1999-10-09 23:17     ` Markus Mottl
1999-10-09 23:52     ` Pierre Weis
1999-10-10  8:14       ` skaller
1999-10-10 12:56       ` Michel Quercia [this message]
1999-10-10 21:16         ` Pierre Weis
1999-10-11  5:37           ` Lyn A Headley
1999-10-12 18:52             ` skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=99101014230201.15999@Montchapet \
    --to=quercia@cal.enst.fr \
    --cc=Pierre.Weis@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox