🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #317

Re: How to neatly destroy instances?

#317
From: Thomas A. Russ
Date: Tue, 13 Oct 1992 00:24
28 lines
1400 bytes
In article <...> huangp@wasser.Colorado.EDU (PeiYu Huang) writes:

 >      Well, by "neatly" I mean something other than:
 > 
 >        cl>(setq my-instance (make-instance 'MY-CLASS))
 >           #<MY-CLASS @ .......)
 > 
 >        cl>(setq my-instance NIL)
 > 
 > All suggestions are welcome. Thanks in advance..
 > 

If you don't use global (special) variables, then you don't need to do
anything to eliminate unused instances.  One simple solution would be:


(let ((my-instance (make-instance 'MY-CLASS)))
  ....)

After the let form, my-instance is not bound and the instance of
MY-CLASS that was created is freed for the garbage collector.

Why do you feel a need to destroy instances explicitly?
--

Thomas A. Russ                                             tar@isi.edu    
USC/ISI, 4676 Admiralty Way, Marina del Rey, CA 90292      (310) 822-1511
Technical Details
Message-ID: <22625@venera.isi.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!usc!isi.edu!venera.isi.edu!tar
References: <1992Oct12.223505.12266@colorado.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ferkel.ucsb.edu!taco!gatech!swrinde!zaphod.mps.ohio-state.edu!usc!isi.edu!venera.isi.edu!tar
From: tar@ISI.EDU (Thomas A. Russ)
Newsgroups: comp.lang.clos,comp.lang.lisp
Subject: Re: How to neatly destroy instances?
Message-ID: <22625@venera.isi.edu>
Date: 13 Oct 92 00:24:46 GMT
References: <1992Oct12.223505.12266@colorado.edu>
Sender: news@isi.edu
Reply-To: tar@isi.edu
Organization: USC-ISI
Lines: 28
In-reply-to: huangp@wasser.Colorado.EDU's message of 12 Oct 92 22:35:05 GMT