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 OAA06796; Thu, 22 Nov 2001 14:11:12 +0100 (MET) 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 OAA06388 for ; Thu, 22 Nov 2001 14:11:12 +0100 (MET) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fAMDBBT28518 for ; Thu, 22 Nov 2001 14:11:11 +0100 (MET) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id OAA10317 for caml-list@inria.fr; Thu, 22 Nov 2001 14:11:06 +0100 Date: Thu, 22 Nov 2001 14:11:06 +0100 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] Newbie question: semantics of 'mutable' in relation to deep / shallow copying of CAML values. Message-ID: <20011122141106.K6496@verdot.inria.fr> References: <11103C7901D5D411B45800508BB02D72012466E7@exchange1.sle.sharp.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <11103C7901D5D411B45800508BB02D72012466E7@exchange1.sle.sharp.co.uk>; from gerard.murphy@sharp.co.uk on Thu, Nov 22, 2001 at 12:25:04PM -0000 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, Nov 22, 2001 at 12:25:04PM -0000, Gerard Murphy wrote: > Surprise! 'value2' is sharing state with 'value1', but neither > 'value1' nor 'value2' are CAML references. There is no specific notion of "reference" in OCaml: the type "ref" is actually implemented as a mutable record: type 'a ref = { mutable contents : 'a } !x is just a shortcut for x.contents x := y is just a shortcut for x.contents <- y -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr