All Manuals > LispWorks User Guide and Reference Manual > 33 The COMMON-LISP Package

NextPrevUpTopContentsIndex

defpackage

Macro
Summary

Remains as defined in Common Lisp, but see *handle-existing-defpackage* for an extension.

Package

common-lisp

Signature

defpackage defined-package-name [[option]] => package

Arguments

defined-package-name

A string designator.

option

Keyword options.

add-use-defaults

A keyword

Values

package

A package.

Description

The macro defpackage is as defined in the ANSI standard, with the inclusion of the :add-use-defaults keyword. However, the standard explicitly declines to define what defpackage does if a package named defined-package-name already exists and is in a state that differs from that described by the defpackage form.

Therefore an extension has been written that allows you to select between alternative behaviors. See *handle-existing-defpackage* for full details.

One non-standard option is supported. :add-use-defaults, with a true argument, causes the package defined-package-name to inherit from the following packages (as well as any explicitly specified by the :use option):

Example
(defpackage "MY-PACKAGE" (:use "CAPI")
                         (:add-use-defaults t))
 
(package-use-list "MY-PACKAGE")
=>
(#<PACKAGE COMMON-LISP> #<PACKAGE LISPWORKS> #<PACKAGE HARLEQUIN-COMMON-LISP> #<PACKAGE CAPI>)
See also

*handle-existing-defpackage*


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex