If you want to delete or smash a package, but discover that a symbol is created in it at run time with intern
, or found in it with intern
or find-symbol
, you have two choices: either change the source to create or manipulate the symbol in another package, or keep the package after all.
If you cannot or do not want to change the source, and the package is large, you face the annoying prospect of having to keep a lot of code in the image for the sake of one symbol created or manipulated at run time. Fortunately, there are ways to get around this.
The method is to migrate the symbols by hand into new or smaller, "dummy" packages. This is the only working method if at compile time you do not know the names of the symbols to be saved.
Create a special package or packages for the symbols mentioned in these calls, and delete the original packages. When this package is created (with make-package
or defpackage
), it should use as few of the other packages in the application as possible. Typically, :use nil
suffices. For example:
(rename-package "XYZ" "XXX")
(push "XXX" *delete-packages*) ; discard pkg
(make-package "XYZ" :use nil) ; new pkg to reference
This allows the real package XYZ
to be deleted without breaking a call to intern
such as the following:
(intern "FISH" "XYZ")
LispWorks Delivery User Guide - 10 Aug 2017