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

Re: with-slots bug (still)

    Date: Tue, 5 Jul 88 12:41:28 EDT
    From: Michael Sokolov <sokolov@waterloo.media.mit.edu>

    In the 8/1 PCL, running in Lucid, the following error occurs:

    (defclass foo () (x y) (:accessor-prefix))
    (defclass bar () (z w) (:accessor-prefix))

    (defmethod foobar ((f foo) (b bar))
      (with-slots (x y) f
	(setf y (+ x (w b)))))

    (setq f (make-instance 'foo :x 1 :y 1))
    (setq b (make-instance 'bar :w 1 :z 1))

    Now, (foobar f b) produces the following:

    OOPS> >>Error: X has no global value

Two comments.

1) This error doesn't happen in the version of PCL we are about to

2) This code uses the now obsolete :accessor-prefix feature.  You should
not use :accessor-prefix anymore, it will be going away shortly.

Your defclass forms should be updated as follows:

(defclass foo ()
     ((x :accessor x)
      (y :accessor y)))

(defclass bar ()
     ((z :accessor z)
      (w :accessor w)))