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.
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:
If you are working in a particular package, you can adjust the tools to display symbols as you would refer to them from that package - that is, as the package sees them. This can make listings clearer and, more importantly, can show you which symbols have been exported from a package.
Doing this changes the process package of the tool. This means that both displayed symbols and symbols typed into the tool are assumed to be in the package specified. This can be useful in a browser, for example, if you intend to browse a number of different objects which come from the same package.
To change the process package for a given type of tool:
Note: If you wish, you can partially type the package name and then click . This allows you to select from a list of all package names which begin with the partial input you have entered. See 3.14 Completion for detailed instructions on using completion.
As an example, imagine you are looking at a list of symbols in the Inspector. You are working in the package foo
, and some of the symbols in the Inspector are in that package, while others are in another package. To change the current package of the Inspector to foo
, follow the instructions below:
The Preferences dialog indicates that common-lisp-user
is the current package in this window.
common-lisp-user
, and type foo
.
In the Inspector all the symbols available from foo
appear without the package prefix foo
. Similarly, all exported symbols in packages which foo
uses appear without a package prefix, while all others have an appropriate package prefix.
LispWorks IDE User Guide (Macintosh version) - 01 Dec 2021 19:36:18