Re: getting slots and methods of an object



Alexis Gallagher wrote:
Is there a clean way to get a list of all the slots, accessors, and
specializing methods defined on an object instance? If there's not a
clean, implementation-independent way to do it, is there a hairy way to
do it in SBCL or CMUCL?

When I asked about this on #cl-gardeners, I was told it required using
the meta-object protocol, which for me is synonymous with dark,
dangerous, implementation-specific black magic. But maybe I'm being too
fearful...

The motivation is that I'm writing a small note and a little bit of code
to introduce python users to Lisp. I'm trying to write a function which
mirrors the generality of the python function dir(), which returns
symbols defined within the namespace of modules, classes, objects, or
functions.

There's a nice two-part tutorial, where the author inspects classes at
the repl using handy tools like DESCRIBE...
http://blogs.bl0rg.net/netzstaub/archives/000507.html
http://blogs.bl0rg.net/netzstaub/archives/000510.html


Tayssir
--
http://wiki.alu.org/Metaobject_Protocol

.