[slime-devel] Re: problem compiling files defining packages

Gary King gwking at metabang.com
Tue Dec 12 23:40:41 UTC 2006


Hi Lynn,

If you unintentionally leave out the (:use #:common-lisp) from a  
package definition, you can run into all manner of confusion because  
all of the symbols you expect to be bound to functions and macros and  
whatnot will not be. Here is a session to give you an idea of what it  
might look like. (This is in Allegro but the same principles apply).  
Maybe this is what happened to you yesterday.


cl-user(1): (defpackage #:my-bad (:use #:excl))
#<The my-bad package>
cl-user(2): (in-package my-bad)
#<The my-bad package>
my-bad(3): (format t "OK")
Error: attempt to call `format' which is an undefined function.
   [condition type: undefined-function]
...
[1] my-bad(4): :pop
my-bad(5): (in-package #:common-lisp-user)
Error: attempt to call `in-package' which is an undefined function.
   [condition type: undefined-function]

...
[1] my-bad(6): :pop
my-bad(7): (defpackage #:my-bad (:use #:common-lisp #:excl))
Error: attempt to call `defpackage' which is an undefined function.
   [condition type: undefined-function]

...
my-bad(9):

On Dec 12, 2006, at 6:08 PM, Lynn Winebarger wrote:

> Zach Beane wrote:
>> Lynn Winebarger <owinebar at indiana.edu> writes:
>>> Hi,
>>>     First, I want to thank the developers for this Lisp IDE.  It's
>>> very cool.  But....
>>>     I was trying to compile a file with C-c M-k, and the file  
>>> started out
>>>
>>> (defpackage "my-package" (:intern <stuff>) (:use "COMMON-LISP"))
>>> (in-package "my-package")
>>>
>>> Now, this is my first attempt at compiling a CL file (under SBCL
>>> 0.9.18), with or with a package involved.  And it kept spitting out
>>> errors for the stuff after these two lines, and I could not for the
>>> life of me see why.
>> What errors do you get? I can't make my system produce an error from
>> what you wrote above (but I'm not sure what you used for <stuff>).
>
> Aaargh.  Despite several hours of frustration last night and this  
> morning, it's not producing an error for me, now, either.
>
> I had first tried the compile/load file on the code below (to give  
> some more context).  It must have "infected" the system, though I  
> quit and restarted Emacs each time to purge the effect of the  
> load.  I am using some of the names from the COMMON-LISP package  
> and it took a few attempts to understand how to override them (and  
> still be able to use the standard language elements).
>
>    The next changes were to add (:use "common-lisp"), which then  
> changed to (:use "COMMON-LISP"), and then added the (:intern  
> "READ" ...).
>
> My apologies,
> Lynn
>
> (defpackage "my-package")
>
> (in-package "my-package")
>
> ;;;; string checker, for catching non-portability early
> (defun make-quote-reader (standard-quote-reader)
>   (lambda (stream char)
>     (let ((result (funcall standard-quote-reader stream char)))
>       (unless (every (lambda (x) (typep x 'standard-char)) result)
> 	(warn "Found non-STANDARD-CHAR in ~S" result))
>       result)))
>
> (compile 'make-quote-reader)
>
> (set-macro-character #\" (make-quote-reader (get-macro-character # 
> \" nil)))
>
> (defun def-name-p (sym)
>   (let ((name (symbol-name sym)))
>     (if (string= (subseq (string-upcase name) 0 2) "DEF")
> 	(if (alphanumericp (char name 3))
> 	    (intern (subseq name 4))
> 	    (intern (subseq name 3)))
> 	nil)))
>
>
> _______________________________________________
> slime-devel site list
> slime-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/slime-devel

--
Gary Warren King, metabang.com
Cell: (413) 885 9127
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM







More information about the slime-devel mailing list