Lisp HUG Maillist Archive

List of all accessors from an object

Hey,
 
is there a way to get a list of all text-input-panes  or accessors from an object?
 
best,
Phil

Re: List of all accessors from an object

I don't know about accessors (as those are just generic methods), but if you take a look at my JSON package for LW, specifically the json-decode-into function:

https://github.com/massung/json/blob/master/json.lisp#L154

You can see how to get all the slots of a class, iterate over them, and then you can use #'typep to determine if the slot-value is a text-input-pane?

Perhaps something like (assumes all slots are bound!)...

(loop
    for slot in (hcl:class-slots (class-of object))
    for slot-name = (slot-definite-name slot)
    for slot-value = (slot-value object slot-name)
    when (typep slot-value 'capi:text-input-pane)
    collect (list slot-name slot-value))

Does this help?

Jeff M.
Philipp Bach
Tuesday, June 17, 2014 9:21 AM
Hey,
 
is there a way to get a list of all text-input-panes  or accessors from an object?
 
best,
Phil
Updated at: 2020-12-10 08:33 UTC