From: Gabor M. <me...@ho...> - 2004-11-24 16:26:44
|
Suppose I have a class with a slot and a function. (defclass xxx () ((slut :reader xxx-slut))) (defun xxx-slot (xxx) 1) Then I realize the typo and try to change the class def to this: (defclass xxx () ((slot :reader xxx-slot))) There is an error which is fine, although a continue restart would be nice: XXX-SLOT already names an ordinary function or a macro. =46rom this point on, all redefinition attempts of xxx fail (including the= =20 original one) with the same error until fmakunbounding xxx-slot. Tested wit= h=20 sbcl 8.15.7 and 8.16.45. It seemed that the problem lies with a fix-slot-accessors trying to remove = a=20 method from the non-generic function xxx-slot and being vocal about its=20 failure. I fixed it temporarily like this and probably broke clos too, but = it=20 at least fixes the above behaviour :-): Index: std-class.lisp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/sbcl/sbcl/src/pcl/std-class.lisp,v retrieving revision 1.70 diff -u -r1.70 std-class.lisp =2D-- std-class.lisp 19 Nov 2004 16:29:06 -0000 1.70 +++ std-class.lisp 24 Nov 2004 16:18:54 -0000 @@ -745,19 +745,23 @@ (defun fix-slot-accessors (class dslotds add/remove) (flet ((fix (gfspec name r/w) (let ((gf (if (fboundp gfspec) =2D (without-package-locks =2D (ensure-generic-function gfspec)) + (unless (and (eq add/remove 'remove) + (not (generic-function-p + (fdefinition gfspec)))) + (without-package-locks + (ensure-generic-function gfspec))) (ensure-generic-function gfspec :lambda-list (case r/w (r '(object)) (w '(new-value object)))))= )) =2D (case r/w =2D (r (if (eq add/remove 'add) =2D (add-reader-method class gf name) =2D (remove-reader-method class gf))) =2D (w (if (eq add/remove 'add) =2D (add-writer-method class gf name) =2D (remove-writer-method class gf))))))) + (when gf + (case r/w + (r (if (eq add/remove 'add) + (add-reader-method class gf name) + (remove-reader-method class gf))) + (w (if (eq add/remove 'add) + (add-writer-method class gf name) + (remove-writer-method class gf)))))))) (dolist (dslotd dslotds) (let ((slot-name (slot-definition-name dslotd))) (dolist (r (slot-definition-readers dslotd)) G=E1bor |