Subject: Re: I miss progv
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 1998/05/12
Newsgroups: comp.lang.scheme
Message-ID: <6j8hjc$12lnu@fido.engr.sgi.com>

Stacy Marsella  <marsella@isi.edu> wrote:
+---------------
| I was porting some code from commonlisp to scheme (bigloo1.9c to be exact).
| It was easy enough but i did hit a snag with progv. Anyone have an eloquent
| way to handle progv in scheme - or some way to evaluate within a constructed
| local binding context.
+---------------

Several Schemes [sorry, dunno if Bigloo is one of them] support a
"fluid-let" form, which is as I understand it roughly a dynamic-wind
wrapped around a temporary assignment to one or more variables. That is:

	(fluid-let ((v0 init0)...) body...)

is roughly [assuming no name capture]:

	(let ((old-v0 v0)...
	      (new-v0 init0)...)
	  (dynamic-wind
	    (lambda () (set! v0 new-v0)...)
	    (lambda () body...)
	    (lambda ()
	      (set! new-v0 v0)...
	      (set! v0 old-v0)...)))

MzScheme has fluid-let built-in, and SLIB provides an R4RS macro version
which will run on several other Schemes.

Given fluid-let, it should then be fairly straightforward to write a "progv"
wrapper macro to transpose the bindings from progv's "(v0 ...) (init0 ...)"
to fluid-let's "(v0 init0)..." form.


-Rob

-----
Rob Warnock, 7L-551		rpw3@sgi.com   http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673 [New area code!]
2011 N. Shoreline Blvd.		FAX: 650-933-4392
Mountain View, CA  94043	PP-ASEL-IA