Re: Listing slots in CLOS



Rupert Swarbrick <rswarbrick@xxxxxxxxx> writes:

Hi,

Is there a function, which will return a list (or whatever) of the slots
in a class that I've got an instance of? I'm working with a weird auto-
generated binding library, which I don't really understand... and I'd
like to be able to eyeball the fields I can play with!

Well, for eyeballing, you could try:

(describe my-insance)
or for interactive use
(inspect my-instance)

The only things I can find are slot-exists-p and slot-bound-p, which of
course aren't quite what I'm after. If there's not a portable way to do
this, I'm using sbcl.

This starts to get into MOP territory (MOP = MetaObject Protocol), which
has accessors that allow you to get the slots for a class. You can get
the class from the instance.

--
Thomas A. Russ, USC/Information Sciences Institute
.