caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@kurims.kyoto-u.ac.jp>
To: jhw@wetware.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Oo.id
Date: Fri, 04 Oct 2002 16:58:24 +0900	[thread overview]
Message-ID: <20021004165824H.garrigue@kurims.kyoto-u.ac.jp> (raw)
In-Reply-To: <44C91AD4-D732-11D6-AD63-000393BA7EBA@wetware.com>

From: james woodyatt <jhw@wetware.com>
> Reading the source code in the caml distribution really didn't help me 
> understand what's going on, so I'm asking the list again:
> 
> 	Why does every class object contain field with unique integer?

Since objects contain a method table, which is composed of closures,
using standard comparison functions on them would be unsafe. In
practice this was even worse as this worked somehow, but only part of
the time :-(
Using the address would be ok for equality, but not for compare, as
the GC may move things around: the result of compare might change.

So we had to add a unique id to each object, which is used for
primitive equality and comparison functions. This also seemed
reasonable to make it available to the user, for use in indexed data
structures.

        Jacques Garrigue
-------------------
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


  reply	other threads:[~2002-10-04  7:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-04  0:43 james woodyatt
2002-10-04  7:58 ` Jacques Garrigue [this message]
2002-10-04 16:52   ` james woodyatt
2002-10-08 19:46   ` Lauri Alanko
2002-10-10  0:52     ` Jacques Garrigue

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=20021004165824H.garrigue@kurims.kyoto-u.ac.jp \
    --to=garrigue@kurims.kyoto-u.ac.jp \
    --cc=caml-list@inria.fr \
    --cc=jhw@wetware.com \
    /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;
as well as URLs for NNTP newsgroup(s).