[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Packages in MCL 2

Marty, it looks like you are having some of the same problems that I did
recently. I got some good explanations from a couple of other
people, especially Kim Barrett; I'll send a copy directly to you.

It is hard to explain in detail what the problems are, but there
are more changes between Steele #1 and Steele #2 than were first 
apparent to me. 

Most of the problems I had have to do with the fact that it is a
good idea NOT to use symbols to name things in these package
defining statements, but you should use upper-case strings
instead, like the paranoid example in Steele Ed.2 p. 272.  This
has to do with the fact that the lisp reader will normally
intern symbols in the current package, even though you thought
you were doing something else.  It seems like you can use
keyword forms instead of strings, but this gives me the willies.

I think there are ambiguities in Steele's definition, and a
perhaps unrelated set in MCL as well.  But it looks like the
paranoid stringification of all symbols and package names works
like Steele says.  Also, Kim Barrett points out that the semantics
of when these statements take effect is different as well. Hence the
following summary of what seems to work:

;in file "utility-funcs.lisp"

(defpackage "UTILITY-FUNCS"    ;note quotes and uppercase
(:use "CL" "CCL" ...)          ;ditto, also that no packages are used by default here
(:export "PRINTC" ...)         ;note quotes and uppercase

(in-package "UTILITY-FUNCS")   ;ditto

(defun printc ...)

;then in the using environment:

(eval-when (:compile-toplevel :load-toplevel :execute)
  (use-package '("UTILITY") "CL-USER"))     ;ditto