From: Ken Bloom Date: 2006-08-27T13:30:16+09:00 Subject: Re: Referencing an object through it's id string. On Sun, 27 Aug 2006 12:16:11 +0900, David Vallner wrote: > Alexandre Hudelot wrote: >> Hello, how does one set a pointer to foo using an id string obtained >> through foo.object_id for instance? >> >> Thanks in advance >> > > Considering that object ids are only valid throughout one interpreter > run... I'm curious: why pass around the object id instead of the object > itself? Have a look at how weakref.rb is implemented. It keeps track of the objects it's referencing by object id, because the garbage collector can't follow those, but the references can get their objects back using ObjectSpace._id2ref (assuming they haven't been garbage collected). --Ken Bloom -- Ken Bloom. PhD candidate. Linguistic Cognition Laboratory. Department of Computer Science. Illinois Institute of Technology. http://www.iit.edu/~kbloom1/