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

with-slots problem



I'm running PCL 7/7/88 on a TI Explorer. When I compile some defmethod
forms containing a with-slots, the with-slots is not expanded correctly,
with the result that slot names are not bound.

For example, when I compile:
	
(defmethod initialize-instance :after ((self virtual-label) &rest init-plist)
  (declare (ignore init-plist))
  (with-slots (title font height width inside-border-width) self
    (when (symbolp title) ;; NIL is a symbol
      (setf title (string-capitalize (string (or title (contact-name self))))))
    (let ((label-font font))
      (setf height (+ (max-char-ascent label-font)
			   (max-char-descent label-font)
			   (* 2 inside-border-width)
			   2))
      (setf width (+ 2 (text-width label-font title))))))


I get the warning "TITLE and INSIDE-BORDER-WIDTH used free".  In this
case, title, font, and inside-border-width are direct slots of the
virtual-button class, while height and width are slots in a (non-local)
superclass of virtual-button.  However, in other apparently similar
defmethods, the problem does not occur.  When with-slots is given
several slot name, only some may be reported unbound.  Either local or
non-local slot names may be left unbound. What's going on?

Here's the result of macro-expanding the above example.

(PROGN
  (EVAL-WHEN (COMPILE LOAD EVAL)
    (PROGN
      (PROGN
	(PCL::LOAD-DEFMETHOD
	  'PCL::STANDARD-METHOD 'INITIALIZE-INSTANCE '(:AFTER)
	  '(VIRTUAL-LABEL) '(SELF &REST INIT-PLIST) (QUOTE NIL)
	  '(:ISL ((FONT HEIGHT TITLE TITLE WIDTH)) :ISL-CACHE-SYMBOL
		 #:|isl-cache|)
	  #'(LAMBDA (SELF &REST INIT-PLIST)
	      (DECLARE (IGNORE INIT-PLIST) (PCL::CLASS SELF VIRTUAL-LABEL))
	      (LET ((PCL::.ISL.
		      (LET ()
			(DECLARE (SPECIAL #:|isl-cache|))
			#:|isl-cache|))
		    (PCL::.PV. NIL))
		(SETQ PCL::.PV.
		      (LET* ((PCL::.CACHE. (CAR PCL::.ISL.))
			     (PCL::W1 (AREF SELF 0))
			     (PCL::.OFFSET.
			       (LOGAND 14
				       (LOGXOR
					 (LET ()
					   (DECLARE
					     (OPTIMIZE (SPEED 3) (SAFETY 0))
					     (INLINE SVREF))
					   (AREF (THE SIMPLE-VECTOR PCL::W1)
						 (THE FIXNUM 0)))))))
			(IF (AND (EQ PCL::W1 (AREF PCL::.CACHE. PCL::.OFFSET.)))
			    (AREF PCL::.CACHE. (1+ PCL::.OFFSET.))
			    (PCL::PRIMARY-PV-CACHE-MISS PCL::.ISL.
							PCL::.OFFSET. PCL::W1
							SELF))))
		(PROGN
		  SELF)
		(BLOCK INITIALIZE-INSTANCE
		  (LET ((#:G5018 SELF))
		    (DECLARE (PCL::VARIABLE-REBINDING #:G5018 SELF))
		    (AND
		      (SYMBOLP
			(LET ((PCL::.INDEX.
				(LET ()
				  (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))
					   (INLINE SVREF))
				  (AREF (THE SIMPLE-VECTOR PCL::.PV.)
					(THE FIXNUM '3)))))
			  (IF (NULL PCL::.INDEX.)
			      (PCL::PV-ACCESS-TRAP #:G5018 '3 PCL::.ISL.)
			      (LET ()
				(DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))
					 (INLINE SVREF))
				(AREF (THE SIMPLE-VECTOR (AREF #:G5018 1))
				      (THE FIXNUM PCL::.INDEX.))))))
		      (PROGN
			(LET ((#:G5019
			       (STRING-CAPITALIZE
				 (STRING (OR TITLE (CONTACT-NAME SELF))))))
			  (LET ((PCL::.INDEX.
				  (LET ()
				    (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))
					     (INLINE SVREF))
				    (AREF (THE SIMPLE-VECTOR PCL::.PV.)
					  (THE FIXNUM '2)))))
			    (IF (NULL PCL::.INDEX.)
				(PCL::PV-ACCESS-TRAP #:G5018 '2 PCL::.ISL.
						     #:G5019)
				(LET ()
				  (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0)))
				  (SYS:SET-AREF
				    (THE SIMPLE-VECTOR (PROGN
							 (AREF #:G5018 1)))
				    (THE FIXNUM (PROGN
						  PCL::.INDEX.))
				    (PROGN
				      #:G5019))))))))
		    (LET ((LABEL-FONT
			    (LET ((PCL::.INDEX.
				    (LET ()
				      (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))
					       (INLINE SVREF))
				      (AREF (THE SIMPLE-VECTOR PCL::.PV.)
					    (THE FIXNUM '0)))))
			      (IF (NULL PCL::.INDEX.)
				  (PCL::PV-ACCESS-TRAP #:G5018 '0 PCL::.ISL.)
				  (LET ()
				    (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))
					     (INLINE SVREF))
				    (AREF (THE SIMPLE-VECTOR (AREF #:G5018 1))
					  (THE FIXNUM PCL::.INDEX.)))))))
		      (LET ((#:G5023
			     (+ (MAX-CHAR-ASCENT LABEL-FONT)
				(MAX-CHAR-DESCENT LABEL-FONT)
				(* 2 INSIDE-BORDER-WIDTH) 2)))
			(LET ((PCL::.INDEX.
				(LET ()
				  (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))
					   (INLINE SVREF))
				  (AREF (THE SIMPLE-VECTOR PCL::.PV.)
					(THE FIXNUM '1)))))
			  (IF (NULL PCL::.INDEX.)
			      (PCL::PV-ACCESS-TRAP #:G5018 '1 PCL::.ISL.
						   #:G5023)
			      (LET ()
				(DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0)))
				(SYS:SET-AREF
				  (THE SIMPLE-VECTOR (PROGN
						       (AREF #:G5018 1)))
				  (THE FIXNUM (PROGN
						PCL::.INDEX.))
				  (PROGN
				    #:G5023))))))
		      (LET ((#:G5027 (+ 2 (TEXT-WIDTH LABEL-FONT TITLE))))
			(LET ((PCL::.INDEX.
				(LET ()
				  (DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0))
					   (INLINE SVREF))
				  (AREF (THE SIMPLE-VECTOR PCL::.PV.)
					(THE FIXNUM '4)))))
			  (IF (NULL PCL::.INDEX.)
			      (PCL::PV-ACCESS-TRAP #:G5018 '4 PCL::.ISL.
						   #:G5027)
			      (LET ()
				(DECLARE (OPTIMIZE (SPEED 3) (SAFETY 0)))
				(SYS:SET-AREF
				  (THE SIMPLE-VECTOR (PROGN
						       (AREF #:G5018 1)))
				  (THE FIXNUM (PROGN
						PCL::.INDEX.))
				  (PROGN
				    #:G5027)))))))))))))))
  (EVAL-WHEN NIL))