[R6RS] safe and unsafe; declarations

William D Clinger will at ccs.neu.edu
Sat Mar 4 07:56:38 EST 2006


Mike wrote:
> Now, when you say that the R6RS specifies how exceptions are
> "handled", you mean that the R6RS specifies what the default handler
> is, right?

Yes.  Not only that, but the R6RS will specify how programs
can shadow the default handlers, and will specify at least
some of those aspects of exception handling that describe
how the programs' handlers are called in safe mode.

> When you say that unsafe mode affects how exceptions
> are handled, does it now affect how exceptions are raised?

My concept is that we pretend unsafe mode does not affect
how exceptions are raised.

This is fiction, but it is a useful fiction.  Its chief
advantage is that we can pretend unsafe mode does not
conflict with any language in the R6RS that might require
exceptions to be raised in certain situations.

In unsafe mode, we pretend that exceptions are still raised
in the usual way, but may be handled in an arbitrarily
perverse way that completely bypasses the R6RS mechanism
for handling those exceptions.  If an implementations wants
its unsafe mode to handle certain exceptions in a way that
is observationally equivalent to not even detecting the
situation, then it could omit all checking for the situation
while continuing to satisfy the R6RS requirement that it
raise the exception in that situation.

> I.e. could a user program still catch them reliably?

No.  All bets are off.

> (I think that's
> not what you mean.)  Or are two different notions of "exceptions" at
> work in the terminology?

There is only one notion of exception, but there are two
mechanisms for handling exceptions.  One mechanism is the
one that will be described in the R6RS, which is presumably
similar to SRFI-34.  The other mechanism is the one used
in unsafe mode, which the R6RS will not constrain in any
way whatsoever.

Will



More information about the R6RS mailing list