Subject: Re: R6RS ?
From: (Rob Warnock)
Date: 17 May 2001 08:08:44 GMT
Newsgroups: comp.lang.scheme
Message-ID: <9e00uc$915mi$>
Riku Saikkonen <> wrote:
| () writes:
| >* Way to catch failure of primitive functions, such as e.g.
| >  division by zero...
| It's not pretty, but this should work (in standard R5RS Scheme):

Nope, sorry!  As has been noted several times before, R5RS specifically
does *NOT* promise this will work!!

	6.4 Control features
	(dynamic-wind before thunk after)
	The effect of using a captured continuation to enter or exit the
	dynamic extent of a call to "before" or "after" is undefined.

Plus, there is no guarantee anywhere in R5RS that "signalling an error"
interacts in any way with dynamic-wind!! At most an implementation is
required to "detect and report" certain errors, but it's not required to
do this by calling a continuation captured with call/cc in the top-level
REPL (albeit that's one "obvious" implementation), and thus it's not
required to execute any "after" thunks in any active dynamic-winds.

This means that R5RS call/cc + dynamic-wind are inadequate to implement
a portable exception-handling system. (...unless you add non-standard
extensions, as MzScheme & others have done.)


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