NextPrevUpTopContentsIndex

*handle-existing-defpackage*

Variable
Summary

Controls LispWorks' response when defpackage is used on an existing package that is different from the definition given.

Package

hcl

Initial value

(:warn :modify)

Description

The standard explicitly declines to define what defpackage does if the named package already exists and is in a different state to that described by the defpackage form. The variable *handle-existing-defpackage* is an extension to Common Lisp which allows you to select between alternative behaviors that are known to be useful.

The two alternatives are to modify the package to conform exactly to the definition, removing features if necessary, or to merely add features specified in the defpackage but missing from the package. You can also control whether a condition is signalled.

The variable consists of a list of any of the following:

:error

Signal an error.

:warn

Signal a warning.

:add

Add the new symbols to the externals, imports, and so on.

:modify

Modify the package to have only these externals.

:verbose

The signalled errors or warnings also contain details of the differences.

The options :error and :warn cannot be specified at the same time. One of :add and :modify must be specified. Undistinguished internals (that is, internal symbols that are not imported or shadowed), :intern options and sizes are ignored when deciding whether to signal.

Note that when you use :modify some symbols can be uninterned if defpackage imports another symbol with the same name from another package through :import-from , :shadowing-import-from or :export . This happens whether the symbol has a definition as a function, a variable, or nay other Lisp construct, so after making such a change in the package, you should re-execute the definitions that were (presumably erroneously) attached to the uninterned symbols.

Notes

*handle-existing-defpackage* is an extension to Common Lisp.

See also

defpackage


LispWorks Reference Manual - 23 Jul 2004

NextPrevUpTopContentsIndex