How to make Lisp forget about previously exported symbols?
Asked Answered
G

3

8

This is how I export symbols :bar and :baz from package foo:

(in-package :cl-user)
(defpackage foo
   (:use :cl)
   (:export :bar :baz))
(in-package :foo)

When I remove :baz from the list of exported symbols SBCL complains and the compilation fails.

 warning: 
     FOO also exports the following symbols:
       (FOO:BAZ)

How can I make SBCL make forget about :baz without reloading SLIME?

Geary answered 5/7, 2012 at 19:6 Comment(0)
B
14

SBCL:

* (apropos "unexport")

UNEXPORT (fbound)


* (documentation 'unexport 'function)

"Makes SYMBOLS no longer exported from PACKAGE."


* (apropos "unintern")

UNINTERN (fbound)


* (documentation 'unintern 'function)

"Makes SYMBOL no longer present in PACKAGE. If SYMBOL was present then T is
returned, otherwise NIL. If PACKAGE is SYMBOL's home package, then it is made
uninterned."
Bumptious answered 5/7, 2012 at 19:23 Comment(0)
U
2

Search led me here, but I had slightly different issue.

; caught WARNING:
;   MY-PACKAGE also uses the following packages:
;     (DEPENDENCY)

For this case, one needs

* (documentation 'unuse-package 'function)

"Remove PACKAGES-TO-UNUSE from the USE list for PACKAGE."
Uncaused answered 9/11, 2020 at 11:0 Comment(0)
M
0

There is plenty of documentation on these issues, which you should read or reread. This package/symbol thing sounds trivial enough at first sight, but it is different enough from what other languages do to be worth some reading (i.e. trying to reuse knowledge from other languages is particularly risky when it comes to packages and symbols).

If, after reading the docs, you still have trouble, try rereading them (the experience gained by having trouble will help you focus on the relevant sections; rereading without getting into trouble between readings is not very productive IMHO).

Some links I found useful:

Matroclinous answered 6/7, 2012 at 5:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.