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 JAA02261; Fri, 4 Oct 2002 09:59:03 +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 JAA13309 for ; Fri, 4 Oct 2002 09:59:02 +0200 (MET DST) Received: from favie.faith.gr.jp (favie.faith.gr.jp [61.127.175.250]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g947wxD17824 for ; Fri, 4 Oct 2002 09:59:00 +0200 (MET DST) Received: from localhost (dhcp7.faith.gr.jp [192.168.1.17]) by favie.faith.gr.jp (8.9.3/8.9.3) with ESMTP id QAA17667; Fri, 4 Oct 2002 16:58:48 +0900 To: jhw@wetware.com Cc: caml-list@inria.fr Subject: Re: [Caml-list] Oo.id In-Reply-To: <44C91AD4-D732-11D6-AD63-000393BA7EBA@wetware.com> References: <44C91AD4-D732-11D6-AD63-000393BA7EBA@wetware.com> X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20021004165824H.garrigue@kurims.kyoto-u.ac.jp> Date: Fri, 04 Oct 2002 16:58:24 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: james woodyatt > 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