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 LAA18217; Sat, 28 Feb 2004 11:00:10 +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 LAA18935 for ; Sat, 28 Feb 2004 11:00:09 +0100 (MET) Received: from nemerle.org (lilith.ii.uni.wroc.pl [156.17.4.7]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i1SA08ae018612 for ; Sat, 28 Feb 2004 11:00:08 +0100 Received: from malekith by nemerle.org with local (Exim 4.24) id 1Ax1GS-0000Ha-8y for caml-list@inria.fr; Sat, 28 Feb 2004 11:00:08 +0100 Date: Sat, 28 Feb 2004 10:56:52 +0100 From: Michal Moskal To: caml-list@inria.fr Subject: Re: [Caml-list] Semantics of physical equality Message-ID: <20040228095652.GA10435@roke.freak> Mail-Followup-To: caml-list@inria.fr References: <20040227225931.GA9161@roke.freak> <20040228094034.81565.qmail@web41905.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040228094034.81565.qmail@web41905.mail.yahoo.com> User-Agent: Mutt/1.4.1i X-PGP-Fingerprint: CF89 1B14 11BE 1CC9 2CA3 7497 5E32 69B4 BC71 B4C2 X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; michal:01 moskal:01 malekith:01 pld-linux:01 caml-list:01 2004:99 michal:01 moskal:01 malekith:01 kernel:01 semantics:01 equality:01 equality:01 mutable:01 mutable:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, Feb 28, 2004 at 10:40:34AM +0100, sejourne kevin wrote: > A definition for mutable structures look ambiguous to > me: > > type test = > { > mutable a:int; > b:int > };; > > let r = {a=0;b=2};; > > let x = r and y = r in > assert((x.a==y.a)&&(x.b==y.b)&&(x==y)) > ;; > > Does this always ok ? Yes, of course. The objects x and y are physically equal (which implies physical equality of their fields). However here x == y would fail: let x = {a = 0; b = 2} let y = {a = 0; b = 2} while x.b==y.b && x.a==y.a would succeed. -- : Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++ : When in doubt, use brute force. -- Ken Thompson :: UL++++$ C++ E--- a? ------------------- 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