[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: USE-PACAKGE (was Re: (unuse-package "CCL") bombs !)



In article <1991Aug9.082517.5007@ircam.fr> duthen@ircam.fr (Jacques Duthen) writes:
>I don't know which are the specs of defining twice the same package,
>but I can easily understand that the system might be confused !

See CLtL2: it's OK so long as the new definition is consistent with the
current state of the package.  However, there has been some confusion
within X3J13 about what "consistent" means in this case.  I believe the
general idea is to allow the same DEFPACKAGE form to be evaluated multiple
times, so long as you don't use other functions to do what DEFPACKAGE can
do.  For instance, this is OK:

	(defpackage foo :export ("BAR"))
	(defpackage foo :export ("BAR"))

but this isn't:

	(defpackage foo :export ("BAR"))
	(export 'foo::quux 'foo)
	(defpackage foo :export ("BAR"))

>(Actually, my file was loaded twice for bootstrap reasons, so I put
>(unless (find-package "RESTORE-LISP") (defpackage ...))
>which works fine.

This shouldn't have the same compile-time behavior, because the compiler
shouldn't execute an UNLESS form at compile time.  You should do:

(eval-when (compile eval load)
  (unless (find-package "RESTORE-LISP") (defpackage ...)))
-- 
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar