Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Hash over ref
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-20 (22:52)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] Hash over ref
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

-- Damien

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: