[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interpreter messages inside a PROGV

David Kieras <kieras@engin.umich.edu> writes:
   I have a problem with some interpreter warnings that intrude into my program

The errors appear within the context of a progv

The variables within the context of the progv are to be dynamic
variables whose names are determined at runtime.  The format is:
   (progv symbols values {form}*)
The symbols in the symbols list are bound to the values in the values
list and the form(s) is(are) executed with the bindings in effect.
It is unclear whether the variables must be declared before they
are used in the context of a progv in the symbol list.

"progv is paricularly useful for writing interpreters for languages
embedded in lisp". (CTL2, Guy Steele Jr.)

Declaring the symbols in the symbol list eliminates the warning about
undeclared free variables.  The bindings are indeed undone when the
forms are executed and the progv terminates.  In the program fragment
below, upon termination the two special variables retain their old values.

(defparameter ^R-CLT 1)
(defparameter ?R-CLT 2)
    `(LET () (SETQ ,OUT (print-db ,IN (QUOTE SM))) NIL)

(let* ((symbol-list '(^R-CLT ?R-CLT))
      (value-list '(nil foo))
       (action-list `((frf-sm-pm ?R-CLT ?R-CLT))))
     (EVAL ACTION))))  

--> output