[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compiling multiple files
I believe a distinction needs to be made here between "loading" a file and
having a file processed by the compiler. Using
(eval-when (eval compile) (load "foobar"))
would be appropriate when the file "foobar" contains definitions (macros,
etc.) that are required a compile time. However, this form alone, even if
seen in a compilation context, would *not* cause the contents of file "foobar"
to be compiled.
Again, what I'm looking for is a function/macro/special form that causes the
contents of a given file to be processed exactly as if the forms within the
file were replacing the call to this function/macro/special form. A possible
(though inefficient) implementation as a macro would look something like:
(defmacro include-file (pathname)
(let ((results nil)
(form nil))
(with-open-file (stream pathname :direction :input)
(loop
(setq form (read stream nil '*eof*))
(if (eq form '*eof*)
(return nil)
(push form results))))
`(progn ,@(nreverse results))))
-Sandra
-------