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 AAA25828; Tue, 16 Jul 2002 00:56:31 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA25893 for ; Tue, 16 Jul 2002 00:56:30 +0200 (MET DST) X-SPAM-Warning: Sending machine is listed in blackholes.five-ten-sg.com Received: from athlon.baretta.com (r-mi214-6a227.tin.it [62.211.4.227]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6FMuTn29300 for ; Tue, 16 Jul 2002 00:56:29 +0200 (MET DST) Received: from baretta.com (localhost.localdomain [127.0.0.1]) by athlon.baretta.com (Postfix) with ESMTP id B62D92724F; Tue, 16 Jul 2002 01:03:28 +0200 (CEST) Message-ID: <3D3354C0.9040403@baretta.com> Date: Tue, 16 Jul 2002 01:03:28 +0200 From: Alessandro Baretta Organization: Baretta srl -- www.baretta.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529 X-Accept-Language: it, en MIME-Version: 1.0 To: John Prevost Cc: zze-MARCHEGAY Michael stagiaire FTRD/DTL/LAN , Ocaml Subject: Re: [Caml-list] Deep copy References: <0489A7888F080B4BA73B53F7E145F29A1B0AF5@LANMHS20.rd.francetelecom.fr> <3D332851.1080909@baretta.com> <86sn2ksjq8.fsf@laurelin.dementia.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk John Prevost wrote: >>>>>>"ab" == Alessandro Baretta writes: >>>>> > > ab> I agree so far. But did you actually test the code below? I > ab> have reason to believe you are mistaken in believing that > ab> mutable fields are shared between Oo.copied objects, in such a > ab> way that assignment to such a field in one object will result > ab> in a modification in the value of the same field in all > ab> copies. I would consider such a behavior a major design flaw > ab> in the language. > > The code he gave is correct. The problem arises not when the object > itself contains a mutable field, but when one of its fields contains a > mutable value. (An object with a mutable field, a string, an array, a > record with a mutable field, a ref, etc.) ... > As far as I can tell, the poster to whom you are responding was simply > pointing this out: if a field contains a mutable value (whether the > field itself is mutable or not), the contents of that field are > copied, which results in physical equality of the field values in > those cases where physical identity is important. He doesn't appear > to have claimed that the copied fields themselves have physical > equality. Ah, yes! My mistake. I misread the previous post. I'm sorry for that. I'm coding too much and sleeping too little. Alex ------------------- 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