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

unwind-protect



    Date: 11 Apr 86 19:47 PST
    From: Pavel.pa@Xerox.COM

    What is the result of this code:

    (proclaim '(special *foo*))

    (let* ((x 'good)
	   (*foo* x))
      (block bar
	(unwind-protect
	  (let ((*foo* 'bad))
	    (return-from bar))
	  (setq x *foo*)))
      x)

    The Zetalisp manual says it will return GOOD, but the silver book is
    silent on the issue.  This should be clarified.

The only possible clarification is an infinite enumeration of scoping
examples.  The scope of the binding of *FOO* to 'BAD does NOT include
the SETQ in the cleanup clause.  In other words, the ONLY time *FOO* has
the value BAD is during the (dynamic extent) of the body of the LET
clause.  The cleanup is outside the LET and therefore the dynamic extent
has finished.