[plt-scheme] inheriting dynamic extent
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