質問

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?

役に立ちましたか?

解決

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."

他のヒント

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:

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."
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top