Re: asdf gensym problem
Gary Byers <[email protected]> Mon, 1 Aug 2005 00:25:58 -0600 (MDT)
| Newsgroups | gmane.lisp.openmcl.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 31 Jul 2005, bryan o'connor wrote:
> part of the problem is that i had polluted my image. i
> must have forgotten to turn off my init file when building
> once.. that's why asdf and asdf1 were there in the first
> place.
>
> but.. that just answers why it started happening recently.
>
> asdf uses make-package in a form like this:
>
> (let ((*package* (make-package ...)))
> ...
> (load ...))
>
> my guess is that this new package is meant to be
> temporary so you don't pollute the current package.
>
> changing the above to:
>
> (let ((temp-package (make-package ...)))
> (let ((*package* temp-package))
> ...
> (load ...))
> (delete-package temp-package))
DELETE-PACKAGE sounds like the right thing; if the package
is "temporary", you probably don't want it to clutter up
the package namespace after you're through with it.
>
> keeps my packages tidy. save-application and reload
> seems to put things back as is.
>
> is there some other reason why there'd be a need for
> a new package?
Packages in CL have to be (uniquely) named; this is a
little unfortunate, but if it weren't true some things
would be hard to express in the reader and printer.
It -is- hard for portable code to know what package
names it can use for its own purposes and what package
names are already used by the implementation. That
might explain why ASDF is using GENSYM, but the
symbols GENSYM creates aren't necessarily unique package
names (and that may depend on what was saved and/or
fasloaded into a particular lisp image, or on what's
in the user's init file or the guts of the implementation.
(If you'd had
(defpackage "asdf2"
...
(:documentation "I like calling packages by this name; what's
stopping me?"))
in your init file, you might have gotten this conflict a long
time ago ...)
ASDF might want to do something like:
(defun unique-package-name ()
"There are many other ways to do this"
(do* ((p (gensym "asdf") (gensym "asdf")))
((not (find-package p)) p)))
and use DELETE-PACKAGE when it's done (just to avoid filling
memory with temporary packages.)
>
>
> ...bryan
>
>