Compile and load the following code, and then call (test):
(declaim (notinline fun))
(defun fun ()
(print 'old))
(defun test ()
(let ((old #'fun))
;; (funcall old)
(defun fun () (print 'new))
(funcall old)
(fun))
(values))
I'd expect it to print OLD and NEW. However, with the Debian
CMUCL 18e-4 on i386, it actually prints NEW and NEW. Is this a
bug, and does the same happen with newer versions?
* (compile-file "gah.lisp")
; Python version 1.1, VM version Intel x86 on 02 AUG 03 11:08:53 am.
; Compiling: /home/kalle/gah.lisp 02 AUG 03 10:56:48 am
; Converted FUN.
; Compiling DEFUN FUN:
; Converted FUN.
; Converted TEST.
; Compiling DEFUN TEST:
; Byte Compiling Top-Level Form:
; gah.x86f written.
; Compilation finished in 0:00:00.
#p"/home/kalle/gah.x86f"
NIL
NIL
* (load "gah")
; Loading #p"/home/kalle/gah.x86f".
T
* (test)
NEW
NEW
*
If I uncomment the first funcall form, then (test) prints OLD,
OLD and NEW, as expected.