different results in REPL and from a file
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Invalid
|
Undecided
|
Unassigned |
Bug Description
1. Save the following into the file "example.lisp".
(defun foo () (princ x) (terpri))
(defun bar () (progv '(x) '("progv") (let ((x "let")) (foo))))
(progv '(x) '("progv") (let ((x "let")) (foo)))
(bar)
(defparameter x "defparameter")
(progv '(x) '("progv") (let ((x "let")) (foo)))
(bar)
2. $ sbcl
3. * (load "example.lisp")
Output:
... (some warnings) ...
progv
progv
let
progv
T
$ sbcl --version
SBCL 1.1.18
$ uname -a
Linux mglap 3.16.5-
* *FEATURES*
(:ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-
:ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :C-STACK-
:COMMON-LISP :COMPARE-
:FLOAT-EQL-VOPS :GENCGC :IEEE-FLOATING-
:LINKAGE-TABLE :LINUX :LITTLE-ENDIAN :MEMORY-
:OS-PROVIDES-
:OS-PROVIDES-
:OS-PROVIDES-
:SB-CORE-
:SB-SIMD-PACK :SB-SOURCE-
:STACK-
:STACK-
:STACK-
:UNWIND-
By putting a 'defparameter' in between two test runs, you've changed the meaning of bindings of X.
The first occurrence of '(let ((x "let"))' is a lexical binding.
The one following defparameter is special because defparameter makes bindings of X pervasively special.
So after loading the above, typing everything in to the REPL again is going to be different as well.