Hi Lispers
I would like to do the following:
(UNLESS (FBOUNDP 'do-something)
(LOAD "do-something-file.cl") )
;;; the do-something-file
(IN-PACKAGE "THE-DO-PACKAGE")
(EXPORT 'do-something)
(DEFUN do-something ()
do-it )
;;; end
(IMPORT 'the-do-package:do-something (FIND-PACKAGE "CL-USER"))
Continuable error in IMPORT:
The symbol do-something, in the package THE-DO-PACKAGE conflicts with those
already accessible in the package COMMON-LISP-USER.
Well, it is accessible after calling (FBOUNDP 'do-something)
How can i avoid it ?
tnx in advance, Nummi
In article <··········@news.rwth-aachen.de> ·······@abmx.rz.rwth-aachen.de writes:
>(UNLESS (FBOUNDP 'do-something)
> (LOAD "do-something-file.cl") )
...
>Continuable error in IMPORT:
>The symbol do-something, in the package THE-DO-PACKAGE conflicts with those
>already accessible in the package COMMON-LISP-USER.
>
> Well, it is accessible after calling (FBOUNDP 'do-something)
You have to avoid interning the symbol before loading the file. Try:
(let ((symbol (find-symbol "DO-SOMETHING" 'cl-user)))
(unless (and symbol (fboundp symbol))
(load "do-something-file.cl")))
You'll have to change all other references to DO-SOMETHING in the file to
use (find-symbol "DO-SOMETHING" 'cl-user) so that they don't intern the
symbol, either.
Alternatively, you could unintern the symbol:
(unless (fboundp 'do-something)
(unintern 'do-something 'cl-user)
(load "do-something-file.cl"))
Note, however, that any other references to DO-SOMETHING in that file will
refer to the the original one (the one that was uninterned), not the one
created by loading do-something-file.cl.
--
Barry Margolin
BBN Planet Corporation, Cambridge, MA
······@{bbnplanet.com,near.net,nic.near.net,netcom.com}
Phone (617) 873-3126 - Fax (617) 873-5124