All Manuals > LispWorks® User Guide and Reference Manual > 37 The HCL Package

add-package-local-nickname Function


Adds a package-local nickname to a package.




add-package-local-nickname local-nickname actual-package &optional package-designator => package

A symbol or a string.
A package designator.
A package designator.
A package.

The function add-package-local-nickname adds local-nickname as the package-local nickname for actual-package in the package designated by package-designator.

If actual-package is a string or symbol, then a package with the same globally visible name must exist.

package-designator defaults to the current package.

The return value package is the package designated by package-designator.

add-package-local-nickname signals a continuable error of type package-error if local-nickname is already a package-local nickname for a package other than actual-package, or if local-nickname is one of "CL", "COMMON-LISP" or "KEYWORD", or if local-nickname is the name (or a nickname of) the package designated by package-designator.

Package-local nicknames are case-sensitive like other package names.

When *package* is bound to package-designator, calls to find-package with one of the local-nicknames will return the corresponding actual-package. The same occurs for the Common Lisp reader and the functions and macros that take a package designator as an argument. That include all the functions and macros in the Common Lisp HyperSpec section The Packages Dictionary that take a package designator argument and also gentemp. Note that this does not inlcude in-package.

In addition, local-nickname will be printed instead of actual-package when printing a symbol whose home package is actual-package while *package* is bound to package-designator.


Package-local nicknames are experimental and subject to change.

Symbol :package-local-nicknames is present on *features* when package-local are supported.

in-package does not recognize package-local nicknames. Its name argument must name be a package name or a global nickname.

The lookup of the symbol inside a tilde slash operator in a FORMAT control string is done with CL-USER as the current package, so will use any local nicknames in CL-USER.

Functions in the LispWorks IDE that take a package argument do not recognize local nicknames. The same is true for Editor commands.

set-up-profiler recognizes package-local nicknames.

The functions in the Java interface that import classes and take a package name argument recognize local nicknames. The same is true for COM interface functions/macros that take package argument.

Using a package-local nickname that matches a global package name or nickname is allowed, but should be avoided because it can be confusing. It produces a warning.

See also

defpackage option :local-nicknames

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:35