[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: :accessor-prefix bug

    I have uncovered what seems to me to be a bug with
    :accessor-prefix.  For

    (defclass foo ()
      ((this :initform 'a))
      (:accessor-prefix nil))

    (defmethod-setf this ((f foo)) (x)
      (print 'here)
      (setf (slot-value f 'this) x))

    (defclass bar (foo)
      ((this :initform 'b)		; simply define a new initial value
       (that :initform 'c))
      (:accessor-prefix nil))

    In class FOO I use :accessor-prefix to generate the THIS and
    SETF-THIS methods.  The SETF-THIS method is then specialized.  In
    class BAR :accessor-prefix is supposed to define THAT and SETF-THAT
    methods, and allow the THIS and specialized SETF-THIS methods to be
    inherited.  It however seems to redefine the SETF-THIS method:

The defclass for the class BAR clearly requests that methods for THIS
setf-THIS THAT and setf-THAT be created.  The use of :accessor-prefix
nil says generate methods for all the slots.

So there is no bug here.  Probably what you should be doing is:

    (defclass bar (foo)
      ((this :initform 'b)		; simply define a new initial value
       (that :initform 'c :accessor that))

Then you would get the behavior you want.

NOTE:  we decided last week to remove the :accessor-prefix and
:reader-prefix options from defclass.  This means that you will have to
start using just :accessor and :reader.

Sorry for the delay in answering this message.