Importing a symbol into KEYWORD should make it act like a keyword
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
New
|
Undecided
|
Unassigned |
Bug Description
* (defpackage :foo (:use) (:export "BAR"))
#<PACKAGE "FOO">
* (import 'foo:bar (find-package "KEYWORD"))
T
* 'foo:bar
FOO:BAR
* foo:bar
==> error, foo:bar is unbound
However:
Importing a symbol S into package P counts as "interning" it in that package (see glossary defn of intern, and the text for the unintern function.) And for the keyword package:
"Interning a symbol in the KEYWORD package has three automatic effects:
1. It causes the symbol to become bound to itself.
2. It causes the symbol to become an external symbol of the KEYWORD package.
3. It causes the symbol to become a constant variable."
So, foo:bar should have become a constant that evaluates to itself when it was imported into the keyword package.
There are subtle issues here with the different between a symbol being accessible in a package, being present in the package, and having the package as its home package. All three of these are distinct concepts.
Additionally: calling (intern "BAR" (find-package "KEYWORD")) in this
example returns the symbol without doing any of those automatic things either.
description: | updated |
It's not clear that the use of the word "Interning" in the sentence "... has three automatic effects" refers to any action other than specifically calling INTERN.
I realize that you disagree, but my testing shows that ECL, ABCL, CMUCL, and Allegro all take "Intern" to mean specifically calling INTERN. They all report that FOO:BAR is unbound; I think we should be consistent with that.