From: Kevin R. <kp...@ma...> - 2008-07-24 22:07:59
|
On Jul 24, 2008, at 17:48, Gerard Robin wrote: > * (load "test.lisp") > > T > * 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 ? CLHS LOAD: "load binds *readtable* and *package* to the values they held before loading the file." -- http://www.lispworks.com/documentation/HyperSpec/Body/f_load.htm That is, LOAD does something to the effect of (defun load (pathname) (let ((*package* *package*) (*readtable* *readtable*)) ...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/> |