Subject: Re: Dynamic-wind
From: (Rob Warnock)
Date: 7 Nov 2001 04:51:24 GMT
Newsgroups: comp.lang.scheme
Message-ID: <9saekc$69eq3$>
felix <> wrote:
| felix wrote in message <3be689f3$0$28958$>...
| >Rob Warnock wrote in message <9s5hqg$5pcji$>...
| >>felix <> wrote:
| >>+---------------
| >>| (besides a small point: the undefined behaviour of invoking continuations
| >>| inside winder-thunks).
| >>+---------------
| >>
| >>Unfortunately, that "small point" makes it impossible to use
| >>call/cc + dynamic-wind as the basis for an exception system.
| >>In fact, within what's guaranteed by R5RS, you can't even
| >>implement a simple "catch/throw" with it!!
| >
| >So the only choice is to use an implementation that handles it
| >properly...
| BTW, you probably mean "unwind-protect", right?

No, I actually did mean "catch/throw" -- particularly the case in
which an inner "catch" for some catch tag wants to override an outer
"catch" for that same tag. The "no captured continuations may be
invoked from within the `after' thunk" restriction prohibits the
inner catch from stopping the unwinding. Not good.

Of course, nested "unwind-protect"s do have exactly the same problem.


p.s. A reminder that we're talking about *R5RS* here, not any
particular implementation. E.g., in early versions of MzScheme,
invoking a captured continuations from within the "after" thunk
of dynamic-wind didn't work [and R5RS allows it not to work],
but they fixed it after I complained and explained why I needed it...
basically to implement a specialized form of "unwind-protect"!!

Rob Warnock, 30-3-510		<>
SGI Network Engineering		<>
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA

[Note: and aren't for humans ]