[plt-scheme] inheriting dynamic extent

From: Doug Orleans (dougo at place.org)
Date: Fri Apr 1 22:54:43 EST 2005

Robby Findler writes:
 > You might try parameters and the parameterization utilities.

Hm, I thought I was familiar with parameters but I hadn't noticed
`current-parameterization' and `call-with-parameterization' before.
Maybe this is what I'm looking for:

(define-syntax lambda-with-current-parameterization
  (syntax-rules ()
    ((_ formals . body)
     (let ((p (current-parameterization)))
       (lambda formals
	 (call-with-parameterization p (lambda () . body)))))))

((let ((x (make-parameter 1)))
   (parameterize ((x 2))
     (lambda-with-current-parameterization () (x)))))
; => 2

I'll have to figure out if this is what I actually wanted...  Thanks.

--dougo at place.org

Posted on the users mailing list.