[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
KCL scoping bug?
A couple of weeks ago I posted what seemed to be a KCL interpreter
scoping bug using the example from CLtL p. 155.
Having seen no response to what seems to be a potential source
of major confusion, I'm reposting the bug - this time on a simpler
piece of code. The interpreter doesn't make a special reference
for Y in spite of the special declaration.
Please note that the bug only manifests itself when interpreted, the
compiler handles the situation correctly.
------------------
KCL (June 3, 1987)
------------------
Starts dribbling to x (1988/5/25, 2:29:20).
NIL
> #'foo
(LAMBDA-BLOCK FOO (X Y Z)
(LET ((X Y) (Y Z)) (DECLARE (SPECIAL Y Z)) (LIST X Y Z)))
>(setq x 'dyn-x y 'dyn-y z 'dyn-z)
DYN-Z
>(foo 'lex-x 'lex-y 'lex-z)
(LEX-Y DYN-Z DYN-Z) ;;; <---- should be (DYN-Y ...)
> (compile 'foo)
; (DEFUN FOO ...) is being compiled.
;; Warning: The variable X is not used.
;; Warning: The variable Y is not used.
;; Warning: The variable Z is not used.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
FOO
>(foo 'lex-x 'lex-y 'lex-z)
(DYN-Y DYN-Z DYN-Z) ;;; <---- this is correct
>
---------
--ilan caron