NextPrevUpTopContentsIndex

*process-initial-bindings*

Special Variable
Summary

Specifies the variables initially bound in a new process.

Package

mp

Description

This specifies the variables that are initially bound in a Lisp process when that process is created. This variable is an association list of symbols and initial value forms. The initial value forms are processed by a simple evaluation that handles symbols and function call forms, but not special operators.As a special case, if the value form is the same as the symbol and that symbol is unbound, then the symbol will be unbound in the new process.

Examples

This example shows a typical use with a bound symbol:

(defvar *binding-1* 10)
(let ((mp:*process-initial-bindings*
       (cons '(*binding-1* . 20)
             mp:*process-initial-bindings*)))
  (mp:process-run-function
   "binding-1"
   '()
   #'(lambda (stream)
       (format stream "~&Binding 1 is ~S.~%" *binding-1*))
   *standard-output*)
  (sleep 1))
=>
Binding 1 is 20.

This example shows the special case with an unbound symbol:

(defvar *binding-2*)
(let ((mp:*process-initial-bindings*
       (cons '(*binding-2* . *binding-2*)
             mp:*process-initial-bindings*)))
  (flet ((check-binding-2 ()
           (mp:process-run-function
            "binding-2"
            '()
            #'(lambda (stream)
                (if (boundp '*binding-2*)
                    (format stream "~&Binding 2 is ~S.~%" *binding-2*)
                  (format stream "~&Binding 2 is unbound.~%")))
            *standard-output*)
           (sleep 1)))
    (check-binding-2)
    (let ((*binding-2* 123))
      (check-binding-2))))
=>
Binding 2 is unbound.
Binding 2 is 123. 

LispWorks Reference Manual - 23 Jul 2004

NextPrevUpTopContentsIndex