From: Nicolas Cannasse <ncannasse@motion-twin.com>
To: Tom Hawkins <tom@confluent.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Physical compare
Date: Wed, 23 Nov 2005 20:49:20 +0100 [thread overview]
Message-ID: <4384C7C0.6070503@motion-twin.com> (raw)
In-Reply-To: <4384C0E3.5030300@confluent.org>
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
next prev parent reply other threads:[~2005-11-23 19:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-23 19:20 Tom Hawkins
2005-11-23 19:38 ` [Caml-list] " Jon Harrop
2005-11-23 19:49 ` Nicolas Cannasse [this message]
2005-11-24 15:33 ` Jean-Christophe Filliatre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4384C7C0.6070503@motion-twin.com \
--to=ncannasse@motion-twin.com \
--cc=caml-list@inria.fr \
--cc=tom@confluent.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox