compiled-function-p on closures

Discussion of Common Lisp
Post Reply
FAU

compiled-function-p on closures

Post by FAU » Thu Feb 03, 2011 12:40 pm

Hi there,

Look at this:

(defun foo (x) x)
(compile 'foo)
(compiled-function-p #'foo) ; => T

But:

(let ((y 2))
(defun foo (x) (* x y)))
(compile 'foo)
(compiled-function-p #'foo) ; => NIL

Shouldn't its value be T?

System: CCL-1.6

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: compiled-function-p on closures

Post by ramarren » Thu Feb 03, 2011 1:18 pm

Well, the Hyperspec for COMPILE says:
Hyperspec wrote:Exceptional Situations:

The consequences are undefined if the lexical environment surrounding the function to be compiled contains any bindings other than those for macros, symbol macros, or declarations.
I never noticed that before. SBCL gives T here.

Post Reply