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

Added Keyword argument to load.



I would find a "compile" option for the LOAD function to be quite
useful.  It would be a simple, upwards compatible change to add
a :COMPILE keyword argument whose values would be NIL (default), T
or :IF-NEEDED.  NIL and T would mean never and always.  :IF-NEEDED would
specify that LOAD should check the FILE-WRITE-DATE of the source
and (possibly non-existent) previous binary file, and compile the source
if the binary doesn't exist or is older than the source.

This would not be intended to replace a full fledged source code control
system or system rebuilder like the Lisp Machine supplies.  It would
be very useful for people, (like students) who write many small Lisp
programs.  Each semester I write several programs, none of which normally
have more than five source files, and no complicated dependancies.
However, I may be forced to move among many different machines,
and it may be impossible for me to maintain a single library of
"personal" utilities that can be accessed by all of the machines I use.

With these needs in mind the two semantic issues of my proposal can
be dealt with.
(1) What should be done about compile-time/load-time dependancies.
For example should there be any concern about loading macro libraries
before compiling specific files.
Answer: No.  Those issues should be dealt with by a larger scale,
probably implementation dependant utility.  These issues are not
critical for small (< 2000 lines) programs which is the scal of programs
which this feature attempts to support.
(2) How can LOAD determine which source file corresponds to which compiled
file.
Answer: (1) Load already is defined to know how to do this, because
it can "in some implementation dependant way" choose whether to
load a text or object version of the file.
	(2) It should check at least the files which it would otherwise
load, and it should check the files which COMPILE-FILE would read and
write if COMPILE-FILE were given the same argument.

Implementations which don't distinguish compiled files would obviously
be free to ignore this keyword.