Article View: comp.lang.clos
Article #447Accessing Class Slots
From: Jon L White
Date: Wed, 27 Feb 1991 22:09
Date: Wed, 27 Feb 1991 22:09
16 lines
1083 bytes
1083 bytes
re: Does any one know if there is a way in standard CLOS to access the value
of a class-allocated slot given the class (and not an instance of it)?
The 1988 CLOS spec certainly doesn't provide such a capability, and the
emerging metaobject protocols do not do so either.
However, in the previously-alluded "introspective" subset of the metaobject
protocol I believe there is a function CLOS:CLASS-PROTOTYPE, and you
can use that as a quick way to get an instance without consing up
a fresh one each time. E.g.,
(defun shared-slot-value (class slot-name)
(slot-value (clos:class-prototype class) slot-name))
-- JonL --
Technical Details
Message-ID:
<9102272209.AA09488@kolyma>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!unreplyable!garbageReferences:
<1991Feb25.214049.29326@msuinfo.cl.msu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!unreplyable!garbage From: jonl@LUCID.COM (Jon L White) Newsgroups: comp.lang.clos Subject: Accessing Class Slots Message-ID: <9102272209.AA09488@kolyma> Date: 27 Feb 91 22:09:27 GMT References: <1991Feb25.214049.29326@msuinfo.cl.msu.edu> Sender: welch@tut.cis.ohio-state.edu Distribution: inet Organization: CommonLoops Lines: 16