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 AAA29142; Fri, 21 May 2004 00:52: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 AAA28957 for ; Fri, 21 May 2004 00:52:30 +0200 (MET DST) Received: from [IPv6:::1] (yquem.inria.fr [128.93.8.37]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4KMqTEV005020 for ; Fri, 21 May 2004 00:52:29 +0200 Mime-Version: 1.0 (Apple Message framework v613) In-Reply-To: <200405202137.00485.jdh30@cam.ac.uk> References: <200405202137.00485.jdh30@cam.ac.uk> Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <5DFDEB16-AAB0-11D8-9E52-00039310CAE8@inria.fr> Content-Transfer-Encoding: 7bit From: Damien Doligez Subject: Re: [Caml-list] Hash over ref Date: Fri, 21 May 2004 00:52:27 +0200 To: caml-list@inria.fr X-Mailer: Apple Mail (2.613) X-Miltered: at nez-perce with ID 40AD36AD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; damien:01 damien:01 caml-list:01 hash:01 hash:01 mutable:01 int:01 doligez:01 doligez:01 initialize:02 wrote:03 object:03 correctly:08 rather:09 references:11 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On May 20, 2004, at 22:37, Jon Harrop wrote: > Is it possible to hash a ref itself, rather than the object it > references? If I understand the question correctly, you want the hash to remain constant even when you update the reference. Then the answer is no. The normal technique for this case is to replace your reference with a record of two fields: a mutable field for the contents, and an int field which you initialize with a random number (or a sequential counter) when you create the record. Then your hash code is this number. -- Damien ------------------- 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