[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiling functions which appear inside top-level forms.



    Question to implementors:
      Will the function #'(lambda (x y)...) be compiled?

In Spice Lisp, yes, this is compiled.

      Will it be a lexical closure?

In this example, the question is moot since the function does not use
anything from the lexical envrionment outside of itself.  But in
general, it will see the lexical environment.

    General question:
      Would it be reasonable to require that it be compiled?

Yes.  There was a lot of discussion before the book came out about the
technique of turning random top-level forms into functions of no args
which the compiler can process normally.  It then emits the definition
followed by a call to this odd function.  We shouldn't require exactly
that, since some implementations would then have trouble GC-ing this
anonymous function, but we should require equivalent semantics in
judging what the compiler compiles.  I don't think this is required
currently -- as you say, the description of Compile-File needs a lot of
work now.

-- Scott