🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #411

Re: accessing clos objects

#411
From: Barry Margolin
Date: Mon, 11 Feb 1991 22:32
27 lines
1881 bytes
In article <MIKEB.91Feb11101840@wdl35.wdl.loral.com> mikeb@wdl35.wdl.loral.com (Michael H Bender) writes:
>    In other words, is there any easy way to access all 
>    the objects that belong to a given class?

There is no automatic mechanism that keeps track of all the instances of a
class.  You may implement such a mechanism for classes you define, though.
You can have a per-class slot (a slot with the (:ALLOCATION :CLASS) option)
that contains a list of all its instances, and define a :BEFORE or :AFTER
method on MAKE-INSTANCE that adds the new instance to the list.  You might
also want to define a REMOVE-INSTANCE method that would remove the
specified instance from the list (otherwise, instances will never get
GCed).

Also, several Common Lisp implementations (Lucid and Symbolics for sure,
and probably also Franz and Allegro) include an extension called
"resources", which maintain caches of recently created, similar objects.
They generally allow the program to list all the objects in a resource, and
automatically delete references to unused objects when there are lots of
them (to allow them to be GCed).  I don't know whether this would be useful
to your application, but you might consider using it if your implementation
provides it (and if complete portability isn't an issue).

--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar
Technical Details
Message-ID: <1991Feb11.223240.20960@Think.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!think.com!barmar
References: <MIKEB.91Feb11101840@wdl35.wdl.loral.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!think.com!barmar
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.lang.clos
Subject: Re: accessing clos objects
Message-ID: <1991Feb11.223240.20960@Think.COM>
Date: 11 Feb 91 22:32:40 GMT
References: <MIKEB.91Feb11101840@wdl35.wdl.loral.com>
Sender: news@Think.COM
Distribution: comp.lang.clos
Organization: Thinking Machines Corporation, Cambridge MA, USA
Lines: 27