From: Eric Hodel Date: 2006-08-01T03:59:10+09:00 Subject: Re: doc patch: weakref. On Jul 31, 2006, at 3:20 AM, Hugh Sasse wrote: > An object may be reclaimed by the garbage collector if there are > no references to it. A Weakref represents a reference the garbage > collector will ignore, This allows the referenced object to be > garbage collected as if nothing else is referring to it. I think this is good enough. > When this happens #weakref_alive? will return false. I think this part of the description should be added to #weakref_alive? > Because Weakref inherits from Delegator it passes method calls to > the object from which it was constructed, so it is of the same Duck > Type. How about something like: A Weakref delegates calls to the referenced object so it can be used in place of the real object. > + # Determine if this Weakref still refers to anything. > def weakref_alive? > @@id_rev_map[self.__id__] == @__id > end How about: Returns false if the referenced object has been garbage collected. -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com