title: Common Lisp special variable scope different for defmethod and defun?
body: <p>either I'm missing something very stupid or the scope of special variables is unexpectedly different for defmethod and defun (tested using SBCL 1.1.14):</p>
  
  <ol>
  <li><p>As expected:</p>
  
  <pre><code>(defun ttprint-object (prefix out)
    (format out "~A: in defun: &lt; ~A &gt;~%" prefix *print-readably*))
  (let ((*print-readably* t))
    (format t "let: calling defun: &lt; ~A &gt;~%" *print-readably*)
    (ttprint-object "from let" t))
  
  let: calling defun: &lt; T &gt;
  from let: in defun: &lt; T &gt;
  </code></pre></li>
  <li><p>With let defmethod works different from defun, so unexpected:</p>
  
  <pre><code>(defclass empty () ())
  
  (defmethod print-object ((self empty) out)
    (format out "in defmethod: &lt; ~A &gt;~%" *print-readably*)
    (ttprint-object "from defmethod" out))
  
  (let ((*print-readably* t))
    (ttprint-object "from let" t)
    (format t "let: calling defmethod: &lt; ~A &gt;~%" *print-readably*)
    (format t "let: ~A" (make-instance 'empty)))
  
  from let: in defun: &lt; T &gt;
  let: calling defmethod: &lt; T &gt;
  let: in defmethod: &lt; NIL &gt;
  from defmethod: in defun: &lt; NIL &gt;
  </code></pre></li>
  <li><p>Also with setf defmethod works different from defun but same as with let:</p>
  
  <pre><code>(progn
    (setq *print-readably* t)
    (ttprint-object "from setf" t)
    (format t "setf: calling defmethod: &lt; ~A &gt;~%" *print-readably*)
    (format t "setf: ~A" (make-instance 'empty)))
  
  from setf: in defun: &lt; T &gt;
  setf: calling defmethod: &lt; T &gt;
  setf: in defmethod: &lt; NIL &gt;
  from defmethod: in defun: &lt; NIL &gt;
  </code></pre></li>
  </ol>
  
  <p>Hopefully it's me...</p>
  
  <p>Thanks in advance, Frank</p>