🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.clos
Article #53

Portability: Adding a slot to a class

#53
From: Nicolas Rouquette
Date: Thu, 30 Jul 1992 23:42
30 lines
1900 bytes
How can I add a slot to a class? One solution is to redefine class but that
isn't terribly portable since it requires having the source definition
of the class. P. 203 of the AMOP describes how a slot instance can be
created, e.g., (make-instance  'clos:standard-slot-definition ...).
Then, the question becomes how can a slot instance be added to a given class
as if it were (almost) a re-definition of the class? Can this be done
in a portable manner? If not, I'd be equally interested in an
implementation-specific solution for Lucid 4.0.2 on sparc.

As an example, adding slots can be used to store additional state information
on objects so as to modify the behavior of an algorithm on those objects.
The algorithm modifications can be implemented as redefinitions of the
public methods of the algorithm so as to use the additional state information.
This approach seems to me elegant and portable. In terms of efficiency,
adding information on the object themselves seems to be the fastest way to
get at that information compared to other storage techniques such as lists,
arrays, or hash tables. 

-- 
Nicolas Rouquette
Artificial Intelligence Group
Jet Propulsion Laboratory
California Institute of Technology
4800 Oak Grove Drive
M/S 525-3660
Pasadena, CA 91109

phone: (818) 306-6171
fax:   (818) 306-6912
Email: rouquett@aig.jpl.nasa.gov
Technical Details
Message-ID: <1992Jul30.234218.28623@jpl-devvax.jpl.nasa.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!sdd.hp.com!elroy.jpl.nasa.gov!ufo!Aig.Jpl.Nasa.Gov!rouquett

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos
Path: arc1-ca.pugleaf.net!sparky!uunet!wupost!sdd.hp.com!elroy.jpl.nasa.gov!ufo!Aig.Jpl.Nasa.Gov!rouquett
From: rouquett@Aig.Jpl.Nasa.Gov (Nicolas Rouquette)
Subject: Portability: Adding a slot to a class
Message-ID: <1992Jul30.234218.28623@jpl-devvax.jpl.nasa.gov>
Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post)
Nntp-Posting-Host: ai-cyclops
Reply-To: rouquett@aig.jpl.nasa.gov
Organization: NASA/Jet Propulsion Laboratory
Date: Thu, 30 Jul 1992 23:42:18 GMT
Lines: 30