Next: , Previous: , Up: Design Choices and Extensions   [Contents][Index]

2.10 Load

Function: load filename &key :verbose :print :if-does-not-exist :if-source-newer :contents

As in standard Common Lisp, this function loads a file containing source or object code into the running Lisp. Several CMU extensions have been made to load to conveniently support a variety of program file organizations. filename may be a wildcard pathname such as *.lisp, in which case all matching files are loaded.

If filename has a pathname-type (or extension), then that exact file is loaded. If the file has no extension, then this tells load to use a heuristic to load the “right” file. The *load-source-types* and *load-object-types* variables below are used to determine the default source and object file types. If only the source or the object file exists (but not both), then that file is quietly loaded. Similarly, if both the source and object file exist, and the object file is newer than the source file, then the object file is loaded. The value of the if-source-newer argument is used to determine what action to take when both the source and object files exist, but the object file is out of date:


The object file is loaded even though the source file is newer.


The source file is loaded instead of the older object file.


The source file is compiled and then the new object file is loaded.


The user is asked a yes or no question to determine whether the source or object file is loaded.

This argument defaults to the value of ext:*load-if-source-newer* (initially :load-object.)

The contents argument can be used to override the heuristic (based on the file extension) that normally determines whether to load the file as a source file or an object file. If non-null, this argument must be either :source or :binary, which forces loading in source and binary mode, respectively. You really shouldn’t ever need to use this argument.

Variable: extensions:*load-source-types*
Variable: extensions:*load-object-types*

These variables are lists of possible pathname-type values for source and object files to be passed to load. These variables are only used when the file passed to load has no type; in this case, the possible source and object types are used to default the type in order to determine the names of the source and object files.

Variable: extensions:*load-if-source-newer*

This variable determines the default value of the if-source-newer argument to load. Its initial value is :load-object.

Next: , Previous: , Up: Design Choices and Extensions   [Contents][Index]