On Jul 24, 2008, at 17:48, Gerard Robin wrote:
> * (load "test.lisp")
> * common-lisp::*package*
> #<PACKAGE "COMMON-LISP-USER">
> It seems that the line: (in-package my-pkg) isn't evaluated because I
> am always in the common-lisp-user package.
> What I am missing ?
"load binds *readtable* and *package* to the values they held before
loading the file."
That is, LOAD does something to the effect of
(defun load (pathname)
(let ((*package* *package*)
...evaluate forms in file...))
Therefore, IN-PACKAGE's assignment of *package* affects the local
binding, which goes away when LOAD returns. The further forms in
test.lisp will see *package* being #<package my-pkg>, however.
If you want to affect *package* as seen at the REPL, you must assign
it outside of any LOAD.
Kevin Reid <http://homepage.mac.com/kpreid/>