[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Son of Efficiency of Closures
From: net%"barmar@think.COM" 20-OCT-1989 05:45:35.40
Subj: Efficiency of local fns and closures
> From: GODDEN%gmr.com@RELAY.CS.NET
> c) I have read that closures cannot be compiled. True? False?
> Implementation dependent? (For extra credit: If true, why?)
>Closures can't be compiled separately from the function that created them.
>If you compile a function that contains internal functions, they will all
>be compiled.
> barmar
Let me add question d) with a different example:
(defun return-a-closure (x)
#'(lambda (y)
(some-function x y)))
(compile 'return-a-closure)
(compiled-function-p (return-a-closure 'bar)) --> nil
Why isn't the returned closure a compiled function? This would indicate
that when the closure is later called, it is evaluated by the interpreter.
If that closure contained some really large Lisp form, then it's going to be
SLOW. Do I understand this correctly?
-Kurt Godden
godden@gmr.com