[plt-scheme] inheriting dynamic extent

From: Doug Orleans (dougo at place.org)
Date: Fri Apr 1 21:17:02 EST 2005

The dynamic extent of a procedure is the time when processing is
"inside" a procedure, but it doesn't include the dynamic extent of
procedures created during this time.  For example:

((let ((x 1))
   (dynamic-wind (lambda () (set! x 2))
                 (lambda () (lambda () x))
                 (lambda () (set! x 1)))))
; => 1

Or equivalently:

((let ((x 1))
   (fluid-let ((x 2))
     (lambda () x))))
; => 1

Is there some way to allow procedures to "inherit" dynamic extent?
(Or some trick to simulate this?)  In other words, is there a way to
make something analogous to this example that returns 2 instead of 1?

--dougo at place.org

Posted on the users mailing list.