Subject: Re: faking dynamic-wind ?
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 17 Dec 2000 10:57:21 GMT
Newsgroups: comp.lang.scheme
Message-ID: <91i66h$c16pt$1@fido.engr.sgi.com>
Brian Denheyer  <briand@zipcon.net> wrote:
+---------------
| Is there a way to "fake" dynamic-wind in a scheme which does not
| support it.  It's not obvious to me that it can be done without
| low-level support of some sort.
+---------------

The minutes of the legendary "June 1992" meeting at Xerox PARC
<URL:ftp://ftp.cs.indiana.edu/pub/scheme-repository/doc/standards/
june-92-meeting.ps.gz> included a "user-mode" reference implementation
of dynamic-wind, but noted:

	Since dynamic-wind interacts with call-with-current-continuation,
	this implementation must replace the usual definition of the latter.

That is, *all* calls to call/cc must be to the one defined in the
dynamic-wind code (which saves away the original function value and
replaces it with its own, by set!-ing the global variable). This can
only work if no built-in route uses call/cc, and if the dynamic-wind
code appears lexical *before* any code that uses call/cc.

+---------------
| Of course, if you could do it without low level support, then what's
| the point of it being in R5RS, right ?
+---------------

Efficiency.


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
Network Engineering		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043