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

Robby Findler robby at cs.uchicago.edu
Thu Oct 26 13:07:39 EDT 2006


At Thu, 26 Oct 2006 10:23:42 -0400, William D Clinger wrote:
> Jason Orendorff wrote:
> > What about at compile time?  Does R5.91RS allow an implementation to
> > detect a contract violation at compile time and reject the program?  I
> > couldn't find any such wording.  I think this should be allowed.
> 
> 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, even if the definition or
>     expression that contains the violation will never be
>     executed.  Implementations are also allowed to raise
>     a &warning exception at those times if they determine
>     that some subexpression would inevitably raise some
>     kind of &violation exception were it ever to be
>     evaluated.


Does this mean that, in conforming implementations of r6, this
expression:

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

might produce 1 and might signal an error (at compile time)?

Robby




More information about the r6rs-discuss mailing list