




 
Symbols can be displayed either with their package information attached or not. In the LispWorks IDE, 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 illustrate this, let us return to our example.
Figure 3.6 Two example packages
 
 
We have two packages: 
FOO1
 and 
FOO2
. 
FOO1
 contains symbols 
bar
 and 
baz
. The symbol 
bar
 has been exported, whereas the symbol 
baz
 is not exported.
When the current package is 
FOO2
, you can refer to 
bar
 without using the package name. This is because 
FOO2
 uses 
FOO1
 and 
bar
 is exported. However to refer to 
baz
 you must still use the 
FOO1
 package name like this: 
foo1::baz
. This is because 
baz
 is not exported.
Note also that when the current package is other than 
FOO1
 or 
FOO2
, you can refer to 
foo1:bar
, but you can only refer to 
baz
 as 
foo1::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 a given type of tool: