[R6RS] Detecting violations at compile time
William D Clinger
will at ccs.neu.edu
Tue Oct 31 13:12:18 EST 2006
At r6rs-discuss, Mike Sperber quoted Robby Findler who
was quoting Mike:
> >> It almost says that it produces a particular result at run time. I
> >> suspect whoever wrote this originally wanted to write:
> >> (call-with-current-continuation
> >> (lambda (exit)
> >> (with-exception-handler
> >> (lambda (x) (exit 1) (lambda () (cons 1 2 3))))))
> >> which returns 1.
> > (I wrote that one. Thanks for the fix.)
> > It can only produce 1 and never be somehow an error (at compile time or
> > any other time)? Excellent. Thanks!
> While I can't speak for the editors and will take up the issue with
> them, I believe this was the intent.
That may have been the intent, but you can't express
that intent without placing some restrictions on the
nonstandard exception handlers that implementations
are allowed to use at compile time. The problem is
that the nonstandard exception handlers that systems
are explicitly allowed to use during parsing, macro
expansion, and compilation can do arbitrarily stupid
things when they see a &warning exception.
While I was writing the above, Mike wrote:
> The essence is that I think we decided that the
> compiler/expander/whatever may report that evaluation of a certain
> expression will raise an exception at run time, but that it is not
> allowed to abort the compilation process or otherwise refuse to run
> the program. Our language says that almost, but not quite. I'd like
> to clarify it to this effect. Any objections?
I don't much care how this is resolved, but I'd like
to see it resolved clearly.
This is not just a trivial clarification. Admitting
exceptions to the language has added a whole new realm
of things that ought to be specified, including the
behavior of the exception handlers that are used during
parsing, macro expansion, compilation, and run time,
and also the interactions of all standard procedures
with the exception system: when are they required to
install exception handlers, when are they forbidden to
install exception handlers; when are they required to
raise exceptions, and when are they forbidden to raise
More information about the R6RS