[Armedbear-devel] export doesn't work

Pascal J. Bourguignon pjb at informatimago.com
Thu May 22 20:00:03 UTC 2014

bonasso <bonasso at traclabs.com> writes:

> Whenever I try to export a symbol to cl-user from another package,
> like (export '(memory-apropos) :cl-user) while in a package called
> memory I get
> "The symbol memory-apropos is not accessible in package
> But if I do:
> (in-package :cl-user)
> (import 'memory::memory-apropos)
> it works.
> Is this a bug?

There's no bug here.


    (in-package :memory)
    (export '(memory-apropos) :cl-user)

you're asking to export from the package named "CL-USER", the symbol
MEMORY::MEMORY-APROPOS that is interned into MEMORY when the lisp reader
reads the EXPORT form.  Since this symbol MEMORY::MEMORY-APROPOS is not
present in the CL-USER package, it cannot be exported from the CL-USER
package, and therefore an error is correctly signaled.

You either import memory::memory-apropos into cl-user before exporting

    (in-package :memory)
    (import '(memory-apropos) :cl-user)
    (export '(memory-apropos) :cl-user)

or you could import cl-user::memory-apropos into memory before exporting

    (in-package :memory)
    (unintern 'memory-apropos) ; remove the old one
    (import '(cl-user::memory-apropos) :memory)
    (export '(memory-apropos) :cl-user)

But in both cases, it's a little strange to be exporting from cl-user a
symbol, the more so when it actually comes from the memory package.

Package named <something>-USER are intended to be leaves in the package
dependency graph, so they usually don't export any symbol, and no other
package uses them.  Exporting a symbol from a package is only useful if
you want to use that package, or if you want to use a single colon
instead of the double colon to qualify those symbols.

__Pascal Bourguignon__
"Le mercure monte ?  C'est le moment d'acheter !"

Armedbear-devel mailing list
Armedbear-devel at common-lisp.net

More information about the armedbear-devel mailing list