[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getting the names of clos object slots
- To: clisp-list, email@example.com
- Subject: Re: getting the names of clos object slots
- From: haible (Bruno Haible)
- Date: Mon, 23 Jan 95 16:26:39 +0100
Dan Stanger <firstname.lastname@example.org> asked:
> is there a way of getting the names of the slots in a clos object?
How to do this, has not been standardized, so it is implementation dependent.
In CLISP, you can iterate through the (clos::class-slot-location-table class)
hash table. The hash keys are the slot names. Something like this:
(defun class-slots (class)
(let ((l '()))
(maphash #'(lambda (slot ignore) (declare (ignore ignore)) (push slot l))
Don Cohen <donc@ISI.EDU> wrote about structures:
> While we're at it, there's genuinely NO way to figure out from the
> structure name and the slot name what the accessor is.
You don't need the accessor once you can use (SLOT-VALUE structure slot-name).