From: Sam S. <sd...@gn...> - 2001-03-22 06:43:52
|
CLISP compiler can produce files which CLISP cannot load!!! ----- foo.lisp ----- (in-package "SYSTEM") (defpackage "FOO" (:use "COMMON-LISP")) (use-package '("FOO") "SYSTEM") (in-package "SYSTEM") (export '(foo::bar) "FOO") -------------------- $ clisp -norc -i d:/sds/foo.lisp -c d:/sds/foo.lisp ;; Loading file D:\sds\foo.lisp ... ;; Loading of file D:\sds\foo.lisp is finished. Compiling file D:\sds\foo.lisp ... Compilation of file D:\sds\foo.lisp is finished. 0 errors, 0 warnings $ clisp -norc -i d:/sds/foo ;; Loading file D:\sds\foo.fas ... ** - Continuable Error symbol BAR should be imported into #<PACKAGE FOO> before being exported. If you continue (by typing 'continue'): You may choose how to proceed. 1. Break [1]> a simple inspection of the file foo.fas reveals the cause of the problem: `foo::bar' being accessible in *package*=SYSTEM at compile time is printed in foo.fas as `bar'. This can be fixed by wrapping the writer of the compiled forms inside something like this: (let ((*package* (make-package (gensym)))) output #Y() (delete-package *package*)) or by adding a variable *print-symbols-with-package* and binding it to non-nil around the compiler... -- Sam Steingold (http://www.podval.org/~sds) Support Israel's right to defend herself! <http://www.i-charity.com/go/israel> Read what the Arab leaders say to their people on <http://www.memri.org/> (let ((a "(let ((a %c%s%c)) (format a 34 a 34))")) (format a 34 a 34)) |