ToC DocOverview CGDoc RelNotes Index PermutedIndex
Allegro CL
Home Previous Up Next Table of Contents Index
  ANSI Common Lisp   11 Packages   11.2 Dictionary of Packages

11.2.18 use-package Function

Syntax:
use-package packages-to-use &optional package    t

Arguments and Values:
packages-to-use - a designator for a list of package designators. The keyword package may not be supplied.

package - a package designator. The default is the current package. The package cannot be the keyword package.

Description:
use-package causes package to inherit all the external symbols of packages-to-use. The inherited symbols become accessible as internal symbols of package.

Packages-to-use are added to the use list of package if they are not there already. All external symbols in packages-to-use become accessible in package as internal symbols. use-package does not cause any new symbols to be present in package but only makes them accessible by inheritance.

use-package checks for name conflicts between the newly imported symbols and those already accessible in package. A name conflict in use-package between two external symbols inherited by package from packages-to-use may be resolved in favor of either symbol by importing one of them into package and making it a shadowing symbol.

Examples:
 (export (intern "LAND-FILL" (make-package 'trash)) 'trash)   T
 (find-symbol "LAND-FILL" (make-package 'temp))   NIL, NIL
 (package-use-list 'temp)  (#<PACKAGE "TEMP">)
 (use-package 'trash 'temp)   T
 (package-use-list 'temp)  (#<PACKAGE "TEMP"> #<PACKAGE "TRASH">)
 (find-symbol "LAND-FILL" 'temp)   TRASH:LAND-FILL, :INHERITED

Side Effects:
The use list of package may be modified.

See Also:
unuse-package, package-use-list, Section 11.1 Package Concepts

Notes:
It is permissible for a package P1 to use a package P2 even if P2 already uses P1. The using of packages is not transitive, so no problem results from the apparent circularity.

Allegro CL Implementation Details:
None.

Home Previous Up Next Table of Contents Index
© Franz Inc. 1998-2005 - File last updated 6-21-2002