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

AndrevanTonder andre at het.brown.edu
Tue Oct 24 10:47:13 EDT 2006


On Tue, 24 Oct 2006, 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.
>
> Opinions will differ on whether this behavior is helpful, and no
> compiler can detect all contract violations at compile time.  Still,
> any optimizing compiler will be able to detect some of these, and
> treating them as errors seems reasonable to me.

It is definitely useful.  Having an error instead of just a warning, 
though, would change the semantics of Scheme, as the expression

   (if #t 1 (cons 2 3 4))  ==> 1

illustrates.  I am not advocating either way.

Andre



More information about the r6rs-discuss mailing list