With the following small program, sbcl/ccl/ecl/clasp print:
abcl prints the first two lines, then throws an error on the last case:
#<THREAD "interpreter" native {20E007BE}>: Debugger invoked on condition of type UNBOUND-VARIABLE
The variable LST is unbound.
Test program:
;; Test if loop var can be named like another var (it can)
(defvar *lstl* '(1 2 3))
(defun same-name (lst)
(loop :for lst :in lst
:do (format t "~A " lst))
(format t "~%"))
(same-name *lstl*) ; should print 1 2 3 - works :-)
;; Test if loop var can be named like a slot (it cannot - works on sbcl/ccl/ecl/clasp)
(defclass foo ()
((lst1 :initarg :lst1)
(lst :initarg :lst))
(:documentation "Just to check a slot with the same name as a local variable."))
(defvar *lsto* (make-instance 'foo :lst1 '(1 2) :lst '(2 3 4)))
;; is the issue with-slots? no, other slot names work fine
(defun same-name2 (foobar)
(with-slots (lst1) foobar
(loop :for lst :in lst1
:do (format t "~A " lst)))
(format t "~%"))
(same-name2 *lsto*) ; should print 1 2 - works :-)
(defun same-name3 (foobar)
(with-slots (lst) foobar
(loop :for lst :in lst ; <-- BUG is here! Second lst isn't recognised as a slot name.
:do (format t "~A " lst)))
(format t "~%"))
(same-name3 *lsto*) ; should print 2 3 4 - fails :-(
With the following small program, sbcl/ccl/ecl/clasp print:
abcl prints the first two lines, then throws an error on the last case:
Test program: