From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA04607; Sat, 31 Jul 2004 12:50:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 MAA06780 for ; Sat, 31 Jul 2004 12:50:05 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6VAo3SH029391 for ; Sat, 31 Jul 2004 12:50:04 +0200 Received: from fichte.ai.univie.ac.at (markus@localhost [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) with ESMTP id i6VAo2Du013194; Sat, 31 Jul 2004 12:50:02 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i6VAo2tE013193; Sat, 31 Jul 2004 12:50:02 +0200 Date: Sat, 31 Jul 2004 12:50:02 +0200 From: Markus Mottl To: Jean-Marie Gaillourdert Cc: caml-list@inria.fr Subject: Re: [Caml-list] const equivalent for mutable types? Message-ID: <20040731105002.GB11964@fichte.ai.univie.ac.at> Mail-Followup-To: Jean-Marie Gaillourdert , caml-list@inria.fr References: <410B5EBD.6060800@cgorski.org> <200407311124.06799.jmg@gaillourdet.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200407311124.06799.jmg@gaillourdet.net> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 410B795B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 const:01 jean-marie:99 overwrite:01 read-only:01 mutable:01 mutable:01 mottl:02 mottl:02 wrote:03 types:03 data:03 markus:04 markus:04 oefai:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 31 Jul 2004, Jean-Marie Gaillourdert wrote: > There is a very simple way to do so: Just don't pass the references > around. For references this is certainly usually the preferred case, but for mutable records this would be plain awkward. You don't always want to copy all data in a structure to an otherwise equivalent constant record. Even in the case of references you might have a SE-problem: what do you do if you suddenly discover that it is necessary to overwrite a reference in a large function which only used the plain value before? This might require tons of changes. If you want to deliberately leave this option open, just pass the reference with an additional "read-only" type constraint. Regards, Markus -- Markus Mottl http://www.oefai.at/~markus markus@oefai.at ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners