🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #14

Re: Avoiding CLASS-PROTOTYPE

#14
From: Len Charest
Date: Tue, 03 Nov 1992 00:26
22 lines
1692 bytes
Allow me to follow-up on my own posting:

In article <1992Nov2.214651.18857@jpl-devvax.jpl.nasa.gov>, charest@Aig.Jpl.Nasa.Gov (Len Charest) writes:
|> Problem: given a metaclass CACHING-CLASS that maintains a list of all its direct 
|> instances, how can I create and use a CLASS-PROTOTYPE for a class based on
|> CACHING-CLASS and also, as a special case, ensure that the CLASS-PROTOTYPE does not
|> appear in the metaclass instance list?

I use the generic function CLASS-DIRECT-INSTANCES to access the instance list.
The following :AROUND method on CLASS-PROTOTYPE solves the problem described
above.

(defmethod class-prototype :around ((class caching-class))
  (let ((prototype (call-next-method)))
    (setf (class-direct-instances class)
          (delete prototype (class-direct-instances class) :test #'eq))
    prototype))

..................................................
                                  Len Charest, Jr.
                 JPL Artificial Intelligence Group
                          charest@aig.jpl.nasa.gov
Technical Details
Message-ID: <1992Nov3.002630.23187@jpl-devvax.jpl.nasa.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!rphroy!caen!sdd.hp.com!elroy.jpl.nasa.gov!ufo!Aig.Jpl.Nasa.Gov!charest
References: <1992Nov2.214651.18857@jpl-devvax.jpl.nasa.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!rphroy!caen!sdd.hp.com!elroy.jpl.nasa.gov!ufo!Aig.Jpl.Nasa.Gov!charest
From: charest@Aig.Jpl.Nasa.Gov (Len Charest)
Newsgroups: comp.lang.clos
Subject: Re: Avoiding CLASS-PROTOTYPE
Keywords: class prototype caching metaclass
Message-ID: <1992Nov3.002630.23187@jpl-devvax.jpl.nasa.gov>
Date: 3 Nov 92 00:26:30 GMT
References: <1992Nov2.214651.18857@jpl-devvax.jpl.nasa.gov>
Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post)
Reply-To: charest@aig.jpl.nasa.gov
Organization: NASA/Jet Propulsion Laboratory
Lines: 22
Nntp-Posting-Host: ai-cyclops