[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compiling multiple files
- To: SCHUMACHER%hplabs.csnet@CSNET-RELAY.ARPA
- Subject: Re: compiling multiple files
- From: SANDRA <LOOSEMORE@UTAH-20.ARPA>
- Date: Wed 4 Sep 85 09:06:07-MDT
- Cc: common-lisp@SU-AI.ARPA
- In-reply-to: <8509032357.AA17278@HP-VENUS>
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
-------