[r6rs-discuss] Compile-time detection of contract violations

AndrevanTonder andre at het.brown.edu
Thu Oct 26 12:32:51 EDT 2006


On Thu, 26 Oct 2006, William D Clinger wrote:

> It is, I think.  Section 9.22 of the R5.91RS draft says:
>
>    Most implementations are able to recognize some violations
>    when parsing, expanding macros, or compiling a definition
>    or expression whose evaluation has not yet commenced in
>    the usual sense.  Implementations are allowed to use
>    nonstandard exception handlers at those times, and are
>    encouraged to raise &syntax exceptions for violations
>    detected at those times,

Given this, it is unclear to me if the intent is that the expressions

   (with-exception-handler (lambda (condition) 1) (cons 1 2 3))

   (with-exception-handler (lambda (condition) 1) (/ 0))

   (with-exception-handler (lambda (condition) 1)
      (length (let ((ones (cons 1 #f)))
                (set-cdr! ones ones)))

should be portably valid Scheme.  I.e., should the fact that there is a custom 
runtime exception handler override any compile-time type checking, thus making 
these expressions valid?

Andre





More information about the r6rs-discuss mailing list