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


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:
> 
> external inj : 'a mut_list -> 'a list = "%identity"
> 
> As always, be *very* careful when using this kind of type system voodoo,
> but it can work under certain circumstances.

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.

With the current ocaml compiler, this might be okay, but I'd be wary of
building this kind of code into a library.

Best regards,

-- 
François Pottier
Francois.Pottier@inria.fr
http://cristal.inria.fr/~fpottier/


  reply	other threads:[~2008-12-14  9:10 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 [this message]
2008-12-14 14:29     ` blue storm
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=20081214091045.GA2341@yquem.inria.fr \
    --to=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).