caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "blue storm" <bluestorm.dylc@gmail.com>
To: Francois.Pottier@inria.fr
Cc: "Edgar Friendly" <thelema314@gmail.com>,
	caml-list@inria.fr, "Christopher L Conway" <cconway@cs.nyu.edu>
Subject: Re: [Caml-list] Immutable cyclic data structures via a
Date: Sun, 14 Dec 2008 15:29:17 +0100	[thread overview]
Message-ID: <527cf6bc0812140629h249f6c0wa5b0eaef9efc836b@mail.gmail.com> (raw)
In-Reply-To: <20081214091045.GA2341@yquem.inria.fr>

On 12/14/08, Francois Pottier <Francois.Pottier@inria.fr> wrote:
> On Sat, Dec 13, 2008 at 07:47:46PM -0600, Edgar Friendly wrote:
>> ExtLib (and thus batteries) uses your unmute (called [inj]) for
>> converting a mutable list into the normal immutable list.  The definition:
>
> This is, in principle, unsound. The compiler could (if it were more
> agressive)
> assume that a value of type 'a list is unaffected by a function call,
> whereas,
> if the list is really mutable, it could actually be written to by the call.

That could be an issue if an immutable list was mutated by the
library. Extlib uses mutability to build new mutable lists, to have
for example a cheap tail-recursive map (you can destructively cons new
cells at the end of the mutable list). The new list is then converted
in constant time to an usual unmutable list, wich is returned by the
function. The reference to the original mutable list is lost, and pure
lists are never converted back.

The mutable list stays inside the function boundary and, assuming the
function is correctly written, there is no observable mutability.


  reply	other threads:[~2008-12-14 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-13 21:45 Christopher L Conway
2008-12-13 23:30 ` [Caml-list] " Jeremy Yallop
2008-12-13 23:43   ` Jeremy Yallop
2008-12-14  1:47 ` Edgar Friendly
2008-12-14  9:10   ` Francois Pottier
2008-12-14 14:29     ` blue storm [this message]
2008-12-14 20:06 ` Richard Jones

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=527cf6bc0812140629h249f6c0wa5b0eaef9efc836b@mail.gmail.com \
    --to=bluestorm.dylc@gmail.com \
    --cc=Francois.Pottier@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=cconway@cs.nyu.edu \
    --cc=thelema314@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).