On May 4, 11:31 pm, André Thieme <splendidl...@googlemail.com> wrote:
> Am 04.05.2011 14:50, schrieb Simon Katz:
>
> >> For example Common Lisp does support this.
>
> > That's not true, or at least it's only partly true.
>
> > Here's a translation of your example into Common Lisp (I added a use
> > of a# in the macro to avoid compiler optimization making the problem
> > go away):
>
> >    (defun f (x) (lambda () x))
> >    (defparameter foo (f 0))
> >    (defmacro bar () `(let ((a# ,foo)) a#))
> >    (defun call-bar () (bar))
>
> > I can compile this within a Lisp image (not compiling to file), and
> > call call-bar with no problems.
>
> > But if I try to compile to file, compilation fails with the error
> >    Object #<Closure (F . 1) 20094F62>  is of type FUNCTION which is not
> > externalizable
>
> You need to wrap it into eval-when or separate functions and macros from
> their use into different files and make sure the right load order is
> used. Then this will work in CL.
>
> Andr

It is not possible to write out a function object (something returned
by lambda, Common Lisp's equivalent of fn) to a compiled file.  No mix
of eval-when, separating functions and macros, and load order can
change that.

Simon

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to