What I was trying to do is to declare a function inline. That function has a macro inside. Depending on whether I declaim it inline or notinline I get two different outcomes.
Well I assume that we always should get the same outcome (semantically) independent of whether we declaime something inline or notinline. Please correct me if I'm wrong.
Code: Select all
(in-package :cl-user)
(defpackage :test
(:use :cl))
(in-package :test)
(defmacro foo ()
`(funcall ',(intern "FOOBAR")))
(defun foobar ()
42)
(declaim (inline bar))
(defun bar ()
(foo))
(in-package :cl-user)
;; Apparently bar is recompiled within the current package on CCL-1.6.
(defun busted ()
(test::bar))
;; Just for information...
(find-symbol "FOOBAR") ; => FOOBAR, :INTERNAL
;; Error!
(busted)
;;; Lets try it with bar not being inlined.
;;; =======================================
(in-package :test)
(declaim (notinline bar))
(defun bar ()
(foo))
(in-package :cl-user)
(unintern 'foobar) ; GC that
(defun busted ()
(test::bar))
;; Runs fine this time.
(busted)
;; Just for information...
(find-symbol "FOOBAR") ; => NIL, NIL