[Openmcl-devel] process-run-function and "dynamic vs lexical"
Taoufik Dachraoui
taoufik.dachraoui at wanadoo.fr
Thu Oct 22 14:16:12 UTC 2009
I run the follwoing tests (1, 2 and 3) and cannot understand why
process-run-function
seems to ignore the definition of the variable y within the scope of
the let
? (defvar y 1)
Y
<1>>>>> First using process-run-function
? (let ((x 2) (y 3))
(labels ((f () (format t "~%x=~A y=~A~%" x y)))
(ccl:process-run-function "test" #'f)))
#<PROCESS test(3) [Reset] #x8D43546>
?
x=2 y=1
?
<2>>>>> AND using funcall
? (let ((x 2) (y 3))
(labels ((f () (format t "x=~A y=~A~%" x y)))
(funcall #'f)))
x=2 y=3
NIL
?
<3>>>> AND last
? (let ((x 2) (y 3)) (format t "x=~A y=~A~%" x y))
x=2 y=3
NIL
?
The last 2 tests are obviously what I expected but I do not understand
why when using process-run-function the y value within the new process
is 1 and not 3. How to explain this, it is really confusing for me?
Taoufik
More information about the Openmcl-devel
mailing list