If I load a file like this:
(defpackage xach (:use cl)) (in-package xach) (defun attack () 'attack)
Then do:
(apropos "attack")
XACH::ATTACK (fbound) ; No value
Then if I M-. on XACH::ATTACK, it jumps to the definition as expected. But then:
(apropos "attack")
ATTACK XACH::ATTACK (fbound) ; No value
Why does ATTACK get interned in the current package?
Thanks, Zach
On Tue, Jan 27 2015, Zach Beane wrote:
If I load a file like this:
(defpackage xach (:use cl)) (in-package xach) (defun attack () 'attack)
[...]
Why does ATTACK get interned in the current package?
To find the position in the file, M-. skips over the first two forms with *read-suppress* = t. But the last form is READ with *read-suppress* = nil and with the current package. That causes the interning.
For a while it was possible to read the last form with *read-suppress* as READ returned stuff like (nil (nil nil nil)) which was good enough to find the beginning positions of lists, but later the reader in SBCL changed and since then it only returns nil and we had to disable *read-suppress*.
Instead of returning non-nil values, our source location recording wrappers could probably store things like (1 (2 3 4)) in a global variable. Then we could again use *read-suppress*.
However, it looks like the patch to better support reader-macros needs to bind *read-suppress* to nil while skipping over forms and will likely cause more unwanted interning.
Helmut
Helmut Eller eller.helmut@gmail.com writes:
On Tue, Jan 27 2015, Zach Beane wrote:
If I load a file like this:
(defpackage xach (:use cl)) (in-package xach) (defun attack () 'attack)
[...]
Why does ATTACK get interned in the current package?
To find the position in the file, M-. skips over the first two forms with *read-suppress* = t. But the last form is READ with *read-suppress* = nil and with the current package. That causes the interning.
For a while it was possible to read the last form with *read-suppress* as READ returned stuff like (nil (nil nil nil)) which was good enough to find the beginning positions of lists, but later the reader in SBCL changed and since then it only returns nil and we had to disable *read-suppress*.
Instead of returning non-nil values, our source location recording wrappers could probably store things like (1 (2 3 4)) in a global variable. Then we could again use *read-suppress*.
However, it looks like the patch to better support reader-macros needs to bind *read-suppress* to nil while skipping over forms and will likely cause more unwanted interning.
Helmut
Actually, the patch I'm cleaning up changes *PACKAGE* after reading the IN-PACKAGE form, so it interns stuff in the XACH package where it's a noop, so it fixes Xach's issue.