Re: Weak pointers

From: Frank Christoph (christo@nextsolution.co.jp)
Date: Mon Mar 17 1997 - 10:13:43 MET


Date: Mon, 17 Mar 1997 18:13:43 +0900
Message-Id: <199703170913.SAA03884@sparc3.co.jp>
From: Frank Christoph <christo@nextsolution.co.jp>
To: caml-list@pauillac.inria.fr
Subject: Re: Weak pointers
In-Reply-To: <199703140840.RAA00341@sparc3.co.jp>
 <199703140840.RAA00341@sparc3.co.jp>

(I wrote:)

>>>>> "Xavier" == Xavier Leroy <Xavier.Leroy@inria.fr> writes:
>> Release 1.04 of Objective Caml is now available. The main novelty in this
>> release is the port of the Caml Light replay debugger. Also, the
>> native-code compiler now works on Silicon Graphics, weak pointers are
>> supported, and the foreign interface was enriched to make calling Caml from
>> C easier.

> What is a "weak pointer"? Is it described in the manual?

  My apologies. I just discovered module Weak in the standard library.
However, I still don't understand the concept. The manual says:

  "A weak pointer is an object that the garbage collector may erase at any
time. A weak pointer is said to be full if it points to an object, empty if
the object was erased by the GC."

  Does this mean that even a full weak pointer can be erased? What does "at
any time" mean --- even if the pointer is still accessible from the root set,
its contents can be erased? Is this intended to contrast with a usual
reference, which must always be initialized? Are weak pointers intended to
model C pointers?

  Could someone post an example of their use?

-- 
Frank Christoph                 Next Solution Co.      Tel: 0424-98-1811
christo@nextsolution.co.jp                             Fax: 0424-98-1500



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:09 MET