[Openmcl-devel] process-run-function and "dynamic vs lexical"

Raymond Wiker rwiker at gmail.com
Thu Oct 22 07:42:32 PDT 2009


On Oct 22, 2009, at 16:16, Taoufik Dachraoui wrote:

> 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
> ?

I'm guessing that y gets thread-specific storage; the new thread gets  
the default binding (1), and not the thread-specific binding in the  
original thread (2).





More information about the Openmcl-devel mailing list