different results in REPL and from a file

Bug #1415569 reported by Mateusz
6
This bug affects 1 person
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-gentoomgkernel #5 SMP Fri Dec 5 18:29:59 CET 2014 x86_64 Intel(R) Pentium(R) CPU 3550M @ 2.30GHz GenuineIntel GNU/Linux

* *FEATURES*
(:ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P :ASDF-UNICODE
 :ALIEN-CALLBACKS :ANSI-CL :ASH-RIGHT-VOPS :C-STACK-IS-CONTROL-STACK
 :COMMON-LISP :COMPARE-AND-SWAP-VOPS :COMPLEX-FLOAT-VOPS :CYCLE-COUNTER :ELF
 :FLOAT-EQL-VOPS :GENCGC :IEEE-FLOATING-POINT :INLINE-CONSTANTS :LARGEFILE
 :LINKAGE-TABLE :LINUX :LITTLE-ENDIAN :MEMORY-BARRIER-VOPS :MULTIPLY-HIGH-VOPS
 :OS-PROVIDES-BLKSIZE-T :OS-PROVIDES-DLADDR :OS-PROVIDES-DLOPEN
 :OS-PROVIDES-GETPROTOBY-R :OS-PROVIDES-POLL :OS-PROVIDES-PUTWC
 :OS-PROVIDES-SUSECONDS-T :PACKAGE-LOCAL-NICKNAMES :RAW-INSTANCE-INIT-VOPS
 :SB-CORE-COMPRESSION :SB-DOC :SB-EVAL :SB-FUTEX :SB-LDB :SB-PACKAGE-LOCKS
 :SB-SIMD-PACK :SB-SOURCE-LOCATIONS :SB-THREAD :SB-UNICODE :SBCL
 :STACK-ALLOCATABLE-CLOSURES :STACK-ALLOCATABLE-FIXED-OBJECTS
 :STACK-ALLOCATABLE-LISTS :STACK-ALLOCATABLE-VECTORS
 :STACK-GROWS-DOWNWARD-NOT-UPWARD :SYMBOL-INFO-VOPS :UNIX
 :UNWIND-TO-FRAME-AND-CALL-VOP :X86-64)

Revision history for this message
Douglas Katzman (dougk) wrote :

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.

Changed in sbcl:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.