[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: List of slots for object?

   Date: Fri, 13 Jul 90 09:52:29 EDT
   From: hall@aplcen.apl.jhu.edu (Marty Hall)
   X-Mailer: Mail User's Shell (6.1 4/26/88)

   Is there a general (non-PCL specific) way of getting a list of the
   slots of an object? In PCL you can do 

   (pcl::slots-to-inspect (class-of <object>) <object>)

In the metaobject protocol, you can do:

  (class-slots (class-of <object>))

to get a list of slot-definition metaobjects.  You can convert that to a
list of slot names by doing:

  (mapcar #'slot-definition-name (class-slots (class-of <object>)))

Most, but not all, CLOS implementations support this part of the
metaobject protocol.