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

(load-time-value *package*) not correctly handled in interpreted mode


Somehow, the load-time-value form seems to be evaluated out of the
binding of *package* that should occur when loading a file in
interpreted mode.

I found out that CMULisp and CLISP behave the same
w.r.t. load-time-value and even found (CLtL2 p. 681) text that may
explain the observed behaviour, but I nevertheless feel uncomfortable
about this incompatibility between interpreted and compiled mode.
After all, CLtL2 p.657 states that load rebinds *package*.
load-time-value is processed inside load so it should use that binding

(in-package "SYSTEM")

(format t "~&Current package is ~A~%" (package-name *package*))

(defun foobar (s)
  (declare (type string s))
  (let ((*package* (load-time-value *package*)))
    (format t "~&Package is ~A~%" (package-name *package*))
    (values (read-from-string s) *package*)))

> (load "load-time-value.lisp")
;; Loading file load-time-value.lisp ...
Current package is SYSTEM
;; Loading of file load-time-value.lisp is finished.
> (sys::foobar "foo")
Package is USER
> (load "load-time-value.fas")
;; Loading file load-time-value.fas ...
Current package is SYSTEM
;; Loading of file load-time-value.fas is finished.
> (sys::foobar "foo")
Package is SYSTEM

> (lisp-implementation-version)
"1994-10-26 (October 1994)"
not very new I know, but as nobody complained, I have no reason to
believe that this has been changed since then.

What do you think about this situation?

 	Joerg Hoehle.
Joerg.Hoehle@gmd.de			hoehle@zeus.gmd.de