Now, we discuss shadowing-import. We skipped over import earlier, as it seemed fairly simple, but shadowing-import is interesting in the way it differs from import, so we’ll talk about it a bit now.
The import function allows a symbol from one package to be visible in another. Note, however, that if a symbol by that name already exists in the package into which the symbol is being imported, an error condition is raised. To avoid the error, you first have to unintern the existing symbol in the package before importing the symbol from the other package.
The shadowing-import function works like import, but shadows any existing symbol rather than raising an error condition. The imported symbol replaces the formerly-existing one.
Here is a transcript of that behaviour. Note that import fails with an error, while shadowing-import succeeds:
CL-USER> (make-package 'foreign) #<PACKAGE "FOREIGN"> CL-USER> (intern "MY-SYMBOL" 'foreign) FOREIGN::MY-SYMBOL NIL CL-USER> (intern "MY-SYMBOL") MY-SYMBOL NIL CL-USER> (import 'foreign::MY-SYMBOL) ; Evaluation aborted on #<NAME-CONFLICT {1002FD4373}>. CL-USER> (shadowing-import 'foreign::MY-SYMBOL) T