From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA19374 for caml-redistribution; Tue, 18 Mar 1997 19:20:44 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA18384 for ; Tue, 18 Mar 1997 18:09:07 +0100 (MET) Received: from hplb.hpl.hp.com (hplb.hpl.hp.com [15.255.59.2]) by concorde.inria.fr (8.7.6/8.7.3) with ESMTP id SAA23374 for ; Tue, 18 Mar 1997 18:09:00 +0100 (MET) Received: from betze.bbn.hp.com by hplb.hpl.hp.com; Tue, 18 Mar 1997 17:08:58 GMT Received: from localhost (localhost [127.0.0.1]) by betze.bbn.hp.com with SMTP (8.7.1/8.7.1) id SAA27847; Tue, 18 Mar 1997 18:08:57 +0100 (MET) Message-Id: <199703181708.SAA27847@betze.bbn.hp.com> X-Authentication-Warning: betze.bbn.hp.com: Host localhost [127.0.0.1] didn't use HELO protocol X-Mailer: exmh version 1.6.4 10/10/95 To: Damien Doligez Cc: caml-list@pauillac.inria.fr Subject: Re: Weak pointers In-Reply-To: Damien.Doligez's message of Tue, 18 Mar 1997 17:07:11 +0100. <199703181607.RAA13208@tobago.inria.fr> X-Face: 7'_lwZ-\~X.Q]-O#D;ju@c|HTi9[>\U8jV5(8sQpm)twOCgN.y]9s:L}A1_]h}_LHF@U5!2 5~FJ"9)`@~BEg9d;ftlb:bj9N>RTv0[VvZe7EMMB:$9hUc]&d9VN? Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 18 Mar 1997 17:08:56 +0000 From: Kohler Markus Sender: weis > >But how do you know then that value is not valid anymore ? > > What do you mean by "valid" ? It remains valid as long as the GC has > not deallocated it. And the weak pointer is erased before the value > is deallocated. > > >The same could be done with a "normal" pointer. > > A normal pointer will never let the GC deallocate the value. OK, I think i got the point, as long as you only use the hash table internally for adding, it's not a problem. If you use the hashtable to directly access specific nodes, you are running into trouble. If you want this feature, weak pointers are not usefull. It depends on what you want to do with your datastructure. If you "only" use your datastructure as a tree you probably want that only one node A is deleted if you call delete(A) for example. In this case you just delete ONE specific pointer to node A. If you want support operations like "delete all nodes A in the tree", it really means you have implemented a graph operation. In this case you have to delete ALL pointers to A. Regards, Markus -- +----------------------------------------------------------------------------+ | Markus Kohler Hewlett-Packard GmbH | | Software Engineer Network & System Management Division| | IT/E Success Team | +----------------------------------------------------------------------------+