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

Compiling functions which appear inside top-level forms.

If the following appears as a top-level form in a file:

(let ((foo (make-foo)))
  (declare (special foo))
  (setf (foo-function foo) #'(lambda (x y) (+ x y)))
  (store-foo-away-somewhere foo))

And I compile and load the file.

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

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

I think that this function should be compiled.  I think portable
programs should be able to count on that.

...turning up burners slightly...

This seems like another instance of the general problem that thex
semantics of compile-file is not well enough defined.  Maybe we should
take another stab at that problems now.  Now that lots of people are
working on new ways to store programs (databases, definition-groups etc)
we can probably get some good feedback about this.  If we wait until
everyone has their new "code database" stuff finished it may be too late
to settle on anything that will make old-fashioned files a tool for
distributing quality portable code.