User Tools


Function PROVIDE, REQUIRE

Syntax

Arguments and Values

Description

provide adds the module-name to the list held by *modules*, if such a name is not already present.

require tests for the presence of the module-name in the list held by *modules*. If it is present, require immediately returns.

Otherwise, an attempt is made to load an appropriate set of files as follows: The pathname-list argument, if non-nil, specifies a list of pathnames to be loaded in order, from left to right. If the pathname-list is nil, an implementation-dependent mechanism will be invoked in an attempt to load the module named module-name; if no such module can be loaded, an error of type error is signaled.

Both functions use string-equal= to test for the presence of a module-name.

Examples

This illustrates a non-portable use of require, because it depends on the implementation-dependent file-loading mechanism.

(require "CALCULUS")

This use of require is non-portable because of the literal physical pathname.

(require "CALCULUS" "/usr/lib/lisp/calculus")

One form of portable usage involves supplying a logical pathname, with appropriate translations defined elsewhere.

(require "CALCULUS" "lib:calculus")

Another form of portable usage involves using a variable or table lookup function to determine the pathname, which again must be initialized elsewhere.

(require "CALCULUS" *calculus-module-pathname*)

Side Effects

provide modifies *modules*.

Affected By

The specific action taken by require is affected by calls to provide (or, in general, any changes to the value of *modules*).

Exceptional Situations

Should signal an error of type type-error if module-name is not a symbol name designator.

If require fails to perform the requested operation due to a problem while interacting with the file system, an error of type file-error is signaled.

An error of type file-error might be signaled if any pathname in pathname-list is a designator for a wild pathname.

See Also

Notes

The functions provide and require are deprecated.

If a module consists of a single package, it is customary for the package and module names to be the same.

\issue{REQUIRE-PATHNAME-DEFAULTS-AGAIN:X3J13-DEC-91} \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT} \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT} \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT} \issue{REQUIRE-PATHNAME-DEFAULTS-YET-AGAIN:RESTORE-ARGUMENT} \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR} \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR} \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR}