0

In the REPL I do: * (defpackage :foo (:use common-lisp)) * (in-package :foo)

#<PACKAGE "FOO">

* *package*

#<PACKAGE "FOO">

If I write the file:

try-package.lisp :

(defpackage :foo (:use common-lisp))
(in-package :foo)

then I load this file:

* (load "try-package")
T 
* *package*
#<PACKAGE "COMMON-LISP-USER">

Why I am always in COMMON-LISP-USER then I should be in FOO ?

Gérard
  • 17
  • 4

1 Answers1

0

LOAD binds *PACKAGE* (and also *READTABLE*) to the value it held before loading the file, like this:

(let ((*package* *package*)
      (*readtable* *readtable*))
  ... ;; really load a file
)          
Anton Kovalenko
  • 20,999
  • 2
  • 37
  • 69