[comp.lang.clos] accessing class definition

jonl@LUCID.COM (Jon L White) (02/27/91)

re: Is there anyway to list all the names of the slots and/or the methods
    defined for a certain class (including the inherited ones)? This will
    help me use a piece of code that is not well documented.

[The following comments may be "old hat" to veteran readers of this list.]

What you are asking for some amount of metaobject functionality.  But
very little of such capability is in the 1988 CLOS specification.  It
had been expected that a follow-on proposal would provide a fuller
"metaobject protocol", but no such proposal has been accepted yet.
Nevertheless, several researchers (especially at Xerox PARC) continue
to work towards the design of a fuller protocol.

In the interim, several Common Lisp vendors have agreed to a minimal
subset of such capabilities.  In an email message last year, Dave
Moon of Symbolics referred to these as "introspective" in that they
are primarily "readers" of critical components of several metaobject
types (as well as some additional class names).  It is expected that
such capabilities will certainly be a part of any acceptable metaobject
protocol; thus Dave also called them a "de-facto" standard.

Without detailing all of this minimal set,  I suggest you try:

  (mapcar #'clos:slot-definition-name (clos:class-slots  <class>))

as a way of obtaining the list you are seeking.  Of course, not
every implementation of CLOS will have exactly these names.


-- JonL --


P.S.: Please note that this discussion list has been moved from
      CommonLoops.PARC@xerox.com   to  commonloops@cis.ohio-state.edu