[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting a list of existing slots
- To: Doug Ruth <RUTH@SRI-ROBOTX.ARPA>
- Subject: Re: getting a list of existing slots
- From: Gregor.pa@Xerox.COM
- Date: Sun, 18 Sep 88 16:49 PDT
- Cc: commonloops.PA@Xerox.COM
- Fcc: BD:>Gregor>mail>outgoing-mail-4.text.newest
- In-reply-to: <590447715.0.RUTH@SRI-ROBOTX.ARPA>
- Line-fold: no
Date: Fri, 16 Sep 88 14:15:14 PST
From: Doug Ruth <RUTH@SRI-ROBOTX.ARPA>
Is there an easy way (e.g., an internal PCL function) to obtain a list of
slots in a defined class? And if so, can one obtain information on whether
the slot has an allocation of :class or :instance, and whether it is
inherited or local?
The generic-function CLASS-SLOTS returns a description of the slots
which are accessible in instances of a given class. This is represented
as a list of slot description objects, each slot description object
represents one slot.
The generic-function slotd-allocation (which at some point will be
renamed to slot-description-allocation) returns the allocation of a
slot.
For example:
(defclass c1 ()
((foo :allocation :class)
(bar)))
(setq slots (pcl::class-slots (find-class 'c1)))
(#<Standard-Slot-Description FOO 482734>
#<Standard-Slot-Description BAR 482734>)
(mapcar #'slot-allocation slots)
(:CLASS :INSTANCE)
This functionality is all a documented part of the metaobject protocol.
Some of the names may change, but the functionality will remain.
-------