NextPrevUpTopContentsIndex

3.7 Displaying packages

Symbols can be displayed either with their package information attached or not. In Common LispWorks, symbols are displayed with the package name attached by default.

For example, suppose you have created a package FOO which includes a symbol named bar and a symbol named baz . Suppose further that you created a new package FOO2 , which used the FOO package. This can be done as shown below:

(defpackage foo (:use "COMMON-LISP"))
(defpackage foo2 (:use "FOO" "COMMON-LISP"))

Note that in defining both packages, the COMMON-LISP package has also been used. It is good practice to use this package, to ensure that commonly-used symbols are available.

When creating packages which use other packages, exported symbols can be called without having to refer to the package name.

To clarify this, let us go back to our example.

Figure 3.2 Two example packages

We have two packages: FOO and FOO2 . FOO contains 2 functions, bar and baz . Suppose that the function bar has been declared as exported, whereas the function baz is not.

When you are in the package FOO2 , you can refer to bar without using the package name (because FOO2 uses FOO and bar is exported), but you must still refer to the FOO package name for baz (because baz is not exported). Note also that when you are in any package other than FOO or FOO2 , you can refer to foo:bar , but you must still refer to foo::baz .

Package names are usually displayed alongside symbols in a list. Having a package entry on every line can be unhelpful, especially if the majority of items listed are from the same package. To hide the package names for the symbols in the active window:

  1. Choose Window > Window Preferences... .
  2. The Preferences dialog for the active window appears.

  3. Uncheck Show Package Names in this dialog.

3.7.1 Specifying a package


Common LispWorks User Guide (Macintosh version) - 5 Jul 2006

NextPrevUpTopContentsIndex