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

Re: compiling multiple files



    Date: Wed, 4 Sep 85 06:00 EDT
    From: Robert W. Kerns <RWK@SCRC-YUKON.ARPA>

	Date: Tue 3 Sep 85 16:57:21-PDT
	From: SCHUMACHER%hplabs.csnet@csnet-relay.arpa

	What you need can be done using the require function (sec 11.8 modules in CLtL)
	assuming that the appropriate provide calls have been made, or you can
	simply use (eval-when (eval compile) (load ...)) .

	 Lee Schumacher
	-------

    This isn't the same thing at all, especially this last
    suggestion.  Loading a file into the compilation
    environment is not the same as compiling it into the file!

    Nor is putting a REQUIRE into a file the same as compiling
    the required software into a resulting file, which is what
    was request.

    I believe this describes the desired behaviour:

    (defmacro insert-file-and-compile (file)
      (with-open-file (stream file)
	(do* ((eof (cons 'eof nil))
	      (form (read stream nil eof) (read stream nil eof))
	      (forms))
	     ((eq form eof)
	      `(progn ,@(nreverse forms)))
	  (push form forms))))

Nit: This isn't quite right because it doesn't take into account the
possible effects of eval-when which might change the readtable or
something for processing the rest of the file.  

Instead of kludges like this, it would be better to have a defined
interface to the compiler which compiles a list of files.  Maybe
COMPILE-FILE can simply be extended to allow a list as its first
argument, INPUT-FILE.