From: ··@zyx.UUCP
Subject: IN-PACKAGE anomaly
Date: 
Message-ID: <372@zyx.UUCP>
There is a strange anomaly in the IN-PACKAGE function of Common LISP
that I would like to call to the attention of this net.

Suppose you have two files, one which contains
	(IN-PACKAGE 'FOO :USE '(BAR))
and the other
	(IN-PACKAGE 'FOO :USE '(BAZ))
and they are both to be loaded as parts of the same module. The order
in which the files are loaded do not affect the final status of the
FOO package. So far there is no problem. Now we come to the anomaly:

Suppose the second file contains (IN-PACKAGE 'FOO) instead. Suddenly
the order in which the files are loaded *does* affect the final status
of the FOO package! If the second file is loaded first, then the FOO
package will be created by IN-PACKAGE, and it will do an implicit :USE
'(LISP). When both files have been loaded, FOO will use *both* the
LISP and BAR packages. If the files are loaded in the other order, FOO
will use *only* the BAR package!

Steele (ISBN 0-932376-41-X) says that if the package already exists
when we encounter IN-PACKAGE, the existing package is augmented to
reflect any new packages in the :USE list. In this case however, there
are no *new* packages in the list, because the list is not there at
all. If instead IN-PACKAGE always would default its :USE argument
to '("LISP"), the anomaly would go away.

One could argue that it is bad programming style to have different
use-lists in different files in the same package, but situations
like this happen sometimes during the evolution of a program.

Any comments are appreciated.
-- 
Bjorn Danielsson, ZYX, +46 8 653205, ...mcvax!enea!zyx!bd
From: ···@spice.cs.cmu.edu.UUCP
Subject: Re: IN-PACKAGE anomaly
Date: 
Message-ID: <1174@spice.cs.cmu.edu>
Usually non-trivial systems (involving multiple files) set up the package
structure in one place.  The uses of IN-PACKAGE in the individual files
simply place the code in this established package environment.  This would
not work if omitting the use list forced the Lisp package to be used.

  Rob