On Sun, 2007-10-07 at 00:34 +0200, Pascal Costanza wrote:
> On 6 Oct 2007, at 23:33, Joubert Nel wrote:
> > Hi,
> > Is it possible to get the accessor methods for a given slot?
> > I've tried (sb-mop:slot-definition-writers) but I always get NIL back.
> > For example, in the code below, (get-slot-names (get-slot-defs =20
> > 'label))
> > works as expected.
> > However, if I call (get-slot-accessors (get-slot-defs 'label)) I get a
> > list of NILs.
> The accessor methods are defined on the direct slots, not the =20
Great, changing to the following works:
(defun get-slot-defs (class)
(sb-mop:class-direct-slots (find-class class)))
> effective slots (and slot-definition-writers and slot-definition-=20
> readers should actually signal an error on effective slots).
It is interesting to note that (slot-definition-writers) will return a
NIL even for DIRECT slots, if you got to them via (class-slots) instead
of (class-direct-slots). This is of course because (class-slots) returns
a list of STANDARD-EFFECTIVE-SLOTS-DEFINITION objects (even for DIRECT
slots), while (class-direct-slots) will return