From: Rupert Swarbrick
Subject: Listing slots in CLOS
Date: 
Message-ID: <3P2dnapDgO6CeXLanZ2dnUVZ8vOdnZ2d@giganews.com>
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!

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.

Rupert

From: Rupert Swarbrick
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <3P2dnaVDgO49enLanZ2dnUVZ8vOdnZ2d@giganews.com>
On Sun, 30 Mar 2008 13:03:59 -0600, Rupert Swarbrick wrote:

> 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!
> 
> 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.
> 
> Rupert

Ahah. By way of

http://www-cgi.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/faq/
lisp_5.faq

I found the mop function (in sbcl)  sb-mop:class-slots. Result!

Sorry for the noise,

Rupert
From: Ken Tilton
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <47efe7b0$0$5626$607ed4bc@cv.net>
Rupert Swarbrick wrote:
> 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!
> 
> 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.

class-slots, or the union of class-direct-slots and class-indirect-slots 
if you are using MCL. This is what we call MOP, not standardized I fear, 
so it depends on your Lisp.

btw, there might be a lot of output sometimes, but some meta-help:

(apropos "SLOTS")

Use your google foo to think of strings that might be in the name of a 
function (or macro or method or global or any symbol) you think might exist.

kenny

-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: D Herring
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <65-dnQXFOvlHqm3anZ2dnUVZ_gqdnZ2d@comcast.com>
Ken Tilton wrote:

> Use your google foo to think of strings that might be in the name of a 
> function (or macro or method or global or any symbol) you think might 
> exist.

And don't forget lispdoc.com; it generally requires less search foo.

- Daniel
From: vanekl
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <fsoqdl$6uo$1@aioe.org>
Rupert Swarbrick wrote:
> 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!
> 
> 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.
> 
> Rupert

[211]> (asdf:oos 'asdf:load-op :closer-mop)
...
[212]> (defclass c1 () (a b))
#1=#<STANDARD-CLASS C1>
[213]> (defclass c2 (c1) (d e f))
#1=#<STANDARD-CLASS C2>
[214]> (closer-mop:compute-slots (find-class 'c2))
(#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)

[217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
          (print (closer-mop:slot-definition-name slot)))

A
B
D
E
F
NIL

originally posted by
__Pascal Bourguignon__
From: vanekl
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <fspapu$9v$2@aioe.org>
vanekl wrote:
> Rupert Swarbrick wrote:
>> 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!
>>
>> 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.
>>
>> Rupert
> 
> [211]> (asdf:oos 'asdf:load-op :closer-mop)
> ...
> [212]> (defclass c1 () (a b))
> #1=#<STANDARD-CLASS C1>
> [213]> (defclass c2 (c1) (d e f))
> #1=#<STANDARD-CLASS C2>
> [214]> (closer-mop:compute-slots (find-class 'c2))
> (#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)
> 
> [217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
>          (print (closer-mop:slot-definition-name slot)))
> 
> A
> B
> D
> E
> F
> NIL
> 
> originally posted by
> __Pascal Bourguignon__

Disregard. This technique works in clisp 2.44 but not in sbcl,
at least not in sbcl 1.0.15.36.



The slot SB-PCL::%CLASS-PRECEDENCE-LIST is unbound in the object #<STANDARD-CLASS C2>.
    [Condition of type UNBOUND-SLOT]

Restarts:
  0: [USE-VALUE] Return a value as the slot-value.
  1: [STORE-VALUE] Store and return a value as the slot-value.
  2: [ABORT] Return to SLIME's top level.
  3: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" {AFBAA19}>)

Backtrace:
   0: ((SB-PCL::FAST-METHOD SLOT-UNBOUND (T T T)) #<unavailable argument> #<unavailable argument>
#<unavailable argument> #<STANDARD-CLASS C2> SB-PCL::%CLASS-PRECEDENCE-LIST)
   1: (SLOT-VALUE #<STANDARD-CLASS C2> SB-PCL::%CLASS-PRECEDENCE-LIST)
   2: (SB-PCL::STD-COMPUTE-SLOTS #<STANDARD-CLASS C2>)
   3: ((SB-PCL::FAST-METHOD SB-MOP:COMPUTE-SLOTS :AROUND (STANDARD-CLASS)) #<unavailable argument>
#S(SB-PCL::FAST-METHOD-CALL :FUNCTION #<FUNCTION (SB-PCL::FAST-METHOD SB-MOP:COMPUTE-SLOTS #)>
:PV NIL :NEXT-METHOD-CALL NIL :ARG-INFO (1)) #<STANDARD-CLASS C2>)
   4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SB-MOP:COMPUTE-SLOTS (FIND-CLASS (QUOTE C2))) #<NULL-LEXENV>)
From: Ken Tilton
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <47f032ea$0$5636$607ed4bc@cv.net>
vanekl wrote:
> vanekl wrote:
> 
>> Rupert Swarbrick wrote:
>>
>>> 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!
>>>
>>> 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.
>>>
>>> Rupert
>>
>>
>> [211]> (asdf:oos 'asdf:load-op :closer-mop)
>> ...
>> [212]> (defclass c1 () (a b))
>> #1=#<STANDARD-CLASS C1>
>> [213]> (defclass c2 (c1) (d e f))
>> #1=#<STANDARD-CLASS C2>
>> [214]> (closer-mop:compute-slots (find-class 'c2))
>> (#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)
>>
>> [217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
>>          (print (closer-mop:slot-definition-name slot)))
>>
>> A
>> B
>> D
>> E
>> F
>> NIL
>>
>> originally posted by
>> __Pascal Bourguignon__
> 
> 
> Disregard. This technique works in clisp 2.44 but not in sbcl,
> at least not in sbcl 1.0.15.36.

I was wondering what that was all about. Seems to me compute-slots it is 
a tad lower-level than some of the other options, and that when it comes 
to flying in the face of a non-standard, the lower the worser.

kenny

-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: vanekl
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <fspdag$896$1@aioe.org>
Ken Tilton wrote:
> 
> 
> vanekl wrote:
>> vanekl wrote:
>>
>>> Rupert Swarbrick wrote:
>>>
>>>> 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!
>>>>
>>>> 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.
>>>>
>>>> Rupert
>>>
>>>
>>> [211]> (asdf:oos 'asdf:load-op :closer-mop)
>>> ...
>>> [212]> (defclass c1 () (a b))
>>> #1=#<STANDARD-CLASS C1>
>>> [213]> (defclass c2 (c1) (d e f))
>>> #1=#<STANDARD-CLASS C2>
>>> [214]> (closer-mop:compute-slots (find-class 'c2))
>>> (#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)
>>>
>>> [217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
>>>          (print (closer-mop:slot-definition-name slot)))
>>>
>>> A
>>> B
>>> D
>>> E
>>> F
>>> NIL
>>>
>>> originally posted by
>>> __Pascal Bourguignon__
>>
>>
>> Disregard. This technique works in clisp 2.44 but not in sbcl,
>> at least not in sbcl 1.0.15.36.
> 
> I was wondering what that was all about. Seems to me compute-slots it is 
> a tad lower-level than some of the other options, and that when it comes 
> to flying in the face of a non-standard, the lower the worser.
> 
> kenny

Disregard the earlier disregard. This works on SBCL as long as you call:

(SB-MOP:FINALIZE-INHERITANCE (find-class 'c2))

before messing with the slots.
From: Ken Tilton
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <47f07ee1$0$15205$607ed4bc@cv.net>
vanekl wrote:
> Ken Tilton wrote:
> 
>>
>>
>> vanekl wrote:
>>
>>> vanekl wrote:
>>>
>>>> Rupert Swarbrick wrote:
>>>>
>>>>> 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!
>>>>>
>>>>> 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.
>>>>>
>>>>> Rupert
>>>>
>>>>
>>>>
>>>> [211]> (asdf:oos 'asdf:load-op :closer-mop)
>>>> ...
>>>> [212]> (defclass c1 () (a b))
>>>> #1=#<STANDARD-CLASS C1>
>>>> [213]> (defclass c2 (c1) (d e f))
>>>> #1=#<STANDARD-CLASS C2>
>>>> [214]> (closer-mop:compute-slots (find-class 'c2))
>>>> (#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)
>>>>
>>>> [217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
>>>>          (print (closer-mop:slot-definition-name slot)))
>>>>
>>>> A
>>>> B
>>>> D
>>>> E
>>>> F
>>>> NIL
>>>>
>>>> originally posted by
>>>> __Pascal Bourguignon__
>>>
>>>
>>>
>>> Disregard. This technique works in clisp 2.44 but not in sbcl,
>>> at least not in sbcl 1.0.15.36.
>>
>>
>> I was wondering what that was all about. Seems to me compute-slots it 
>> is a tad lower-level than some of the other options, and that when it 
>> comes to flying in the face of a non-standard, the lower the worser.
>>
>> kenny
> 
> 
> Disregard the earlier disregard. This works on SBCL as long as you call:
> 
> (SB-MOP:FINALIZE-INHERITANCE (find-class 'c2))
> 
> before messing with the slots.

Great, but it is still the wrong entry point:

"Generic Function class-slots class

Returns a possibly empty set of the slots accessible in instances of 
class. The elements of this set are effective slot definition metaobjects.

During class finalization finalize-inheritance calls compute-slots to 
compute the slots of the class. That value is associated with the class 
metaobject and is returned by class-slots.

This generic function signals an error if class has not been finalized."

http://www.lisp.org/mop/dictionary.html#class-mo-readers

kt

-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: Pascal Costanza
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <65bflmF2daf6pU1@mid.individual.net>
Ken Tilton wrote:
> 
> 
> vanekl wrote:
>> Ken Tilton wrote:
>>
>>>
>>>
>>> vanekl wrote:
>>>
>>>> vanekl wrote:
>>>>
>>>>> Rupert Swarbrick wrote:
>>>>>
>>>>>> 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!
>>>>>>
>>>>>> 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.
>>>>>>
>>>>>> Rupert
>>>>>
>>>>>
>>>>>
>>>>> [211]> (asdf:oos 'asdf:load-op :closer-mop)
>>>>> ...
>>>>> [212]> (defclass c1 () (a b))
>>>>> #1=#<STANDARD-CLASS C1>
>>>>> [213]> (defclass c2 (c1) (d e f))
>>>>> #1=#<STANDARD-CLASS C2>
>>>>> [214]> (closer-mop:compute-slots (find-class 'c2))
>>>>> (#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
>>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
>>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
>>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
>>>>>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)
>>>>>
>>>>> [217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
>>>>>          (print (closer-mop:slot-definition-name slot)))
>>>>>
>>>>> A
>>>>> B
>>>>> D
>>>>> E
>>>>> F
>>>>> NIL
>>>>>
>>>>> originally posted by
>>>>> __Pascal Bourguignon__
>>>>
>>>>
>>>>
>>>> Disregard. This technique works in clisp 2.44 but not in sbcl,
>>>> at least not in sbcl 1.0.15.36.
>>>
>>>
>>> I was wondering what that was all about. Seems to me compute-slots it 
>>> is a tad lower-level than some of the other options, and that when it 
>>> comes to flying in the face of a non-standard, the lower the worser.
>>>
>>> kenny
>>
>>
>> Disregard the earlier disregard. This works on SBCL as long as you call:
>>
>> (SB-MOP:FINALIZE-INHERITANCE (find-class 'c2))
>>
>> before messing with the slots.
> 
> Great, but it is still the wrong entry point:
> 
> "Generic Function class-slots class
> 
> Returns a possibly empty set of the slots accessible in instances of 
> class. The elements of this set are effective slot definition metaobjects.
> 
> During class finalization finalize-inheritance calls compute-slots to 
> compute the slots of the class. That value is associated with the class 
> metaobject and is returned by class-slots.
> 
> This generic function signals an error if class has not been finalized."
> 
> http://www.lisp.org/mop/dictionary.html#class-mo-readers

Class finalization is the step that is performed before the very first 
instance of a class is created (via make-instance). CLOS specifies that 
this step can be delayed, in order to allow handling of forward 
referenced classes: A class may have a direct superclass whose 
definition isn't loaded yet. The only time where it is strictly 
necessary that it is loaded is when the first instance of a class is 
created - hence, the separate class finalization step.

Clisp doesn't delay that step but finalizes classes immediately. SBCL 
delays that step - that's why you get the error when you call 
compute-slots or class-slots immediately after a class has been defined.

You can call finalize-inheritance yourself to make sure that 
compute-slots and class-slots don't throw an error. However, note that 
finalize-inheritance itself may throw an error in case one of the 
superclasses is a forward referenced class that doesn't exist yet. So 
there is no way to guarantee that you don't get an error when inspecting 
certain class properties.

There is a predicate class-finalized-p that you can test. It never 
throws an error an class metaobjects, but tells you whether you can 
safely inspect other class properties or not.

The delay of finalizing class definitions comes from the specification 
of defclass in the HyperSpec, where it says that "it is not required 
that the superclasses of a class be defined before the defclass form for 
that class is evaluated" and "all the superclasses of a class must be 
defined before an instance of the class can be made."

The delay is further detailed in the CLOS MOP specification under the 
heading "the class finalization protocol."

It is important that you study these protocols in detail, and not just 
guess and use a try-and-error approach.


Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Pascal Costanza
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <65ajspF2e45a3U1@mid.individual.net>
vanekl wrote:
> Rupert Swarbrick wrote:
>> 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!
>>
>> 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.
>>
>> Rupert
> 
> [211]> (asdf:oos 'asdf:load-op :closer-mop)
> ...
> [212]> (defclass c1 () (a b))
> #1=#<STANDARD-CLASS C1>
> [213]> (defclass c2 (c1) (d e f))
> #1=#<STANDARD-CLASS C2>
> [214]> (closer-mop:compute-slots (find-class 'c2))
> (#<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION A #x2052E666>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION B #x2052E6A6>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION D #x2052E6E6>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION E #x2052E726>
>  #<CLOS:STANDARD-EFFECTIVE-SLOT-DEFINITION F #x2052E766>)
> 
> [217]> (dolist (slot (closer-mop:compute-slots (find-class 'c2)))
>          (print (closer-mop:slot-definition-name slot)))
> 
> A
> B
> D
> E
> F
> NIL

Don't use compute-slots every time. Just use class-slots.

Compute-slots actually performs a computation (hence the name), to 
traverse the class hierarchy and determine all the effective slots for a 
class. This can be a relatively costly computation. Class-slots just 
looks up the recently computed set of slots.

That's a general rule of thumb: If you only want to look at what 
properties a class (or any metaobject) has, avoid the compute-xyz 
functions, but first check whether there are any readers for the 
information you're looking for.

Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Thomas A. Russ
Subject: Re: Listing slots in CLOS
Date: 
Message-ID: <ymi7ifiakv9.fsf@blackcat.isi.edu>
Rupert Swarbrick <··········@gmail.com> 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