[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-11-23 (19:40) |
From: | Nicolas Cannasse <ncannasse@m...> |
Subject: | Re: [Caml-list] Physical compare |
Tom Hawkins wrote: > Is their a version of "compare" that is based on physical equality? If > not, how can I define one? I tried: > > let compareq a b = if a == b then 0 else if a > b then 1 else (-1) > > But unfortunately, (>) is a structural comparison. > > I need to make a Map where the keys are distinguished by the physical > instance. > > Thanks! > > -Tom It's not possible. One of the reason is that the GC might move your memory addresses around and then break your Map constitency. You need to attribute an unique id to each of your items and use it for comparison. Nicolas