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. Clearly it had something to do with the package declaration, because when I commented the above two lines out, I was able to compile the rest of the file. So I drop into a command line SBCL session, and the file compiled just fine.
Anyway, I just wanted to let you know, this was very confusing for a CL newbie (been a Schemer for years, just not CL). It doesn't appear to be in the documentation anywhere. I did find some emails that looked vaguely related from the archives of this list using the gmane interface, but it wasn't something I could easily understand.
I'm wondering, as CL developers, how do you get around this issue? It seems like it would be a problem.
Thanks, Lynn
Lynn Winebarger owinebar@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>).
It doesn't appear to be in the documentation anywhere.
DEFPACKAGE is documented here:
http://www.lispworks.com/documentation/HyperSpec/Body/m_defpkg.htm
IN-PACKAGE is documented here:
http://www.lispworks.com/documentation/HyperSpec/Body/m_in_pkg.htm
Zach
Zach Beane wrote:
Lynn Winebarger owinebar@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)))
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@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@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