Subject: Re: faking dynamic-wind ?
From: (Rob Warnock)
Date: 23 Dec 2000 05:14:14 GMT
Newsgroups: comp.lang.scheme
Message-ID: <921cb6$etvho$>
Joe Marshall  <> wrote:
| dynamic-wind started off as a `first-class continuation aware' version
| of lisp's unwind-protect.  Unwind-protect is used for cleaning things
| up, never for multithreading.  If dynamic-wind is unsuitable for
| cleanup, I don't think that attempting to shoehorn it into a
| multithreading role is appropriate.

And as I pointed out in <URL:news:91uk40$f165j$>,
dynamic-wind (at least, the R5RS version) is not suitable for cleanup
at all, since it doesn't allow you to stop the unwinding! [Result of
call/cc in "after" thunk is undefined.]

| > Anyway, call/wc is a more complicated construct than call/cc.
| > That R5RS provides the complicated one and not the simple one
| > as a primitive is what I consider the deficiency.
| Maybe we should figure out two things:
|   1.  How do you do `unwind-protect' in Scheme if not via
|       dynamic-wind?

You don't, at least not an conform to the standard. [My article ref'd
above showed a non-standard way that works in SCM & MzScheme, but...]

But even if you did, there's no guarantee in the standard that *system*
errors will unwind, so it's useless in any case. Whereas in Common Lisp,
there *is* a guarantee that an unwind-protect will catch exceptions:

	Unwind-protect protects against all attempts to exit from


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