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

Abdulaziz Ghuloum aghuloum at cs.indiana.edu
Thu Oct 26 15:42:21 EDT 2006


On Oct 26, 2006, at 12:32 PM, AndrevanTonder wrote:

> 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.


Actually, this raises another question.  Can I write the procedure 
call-with-no-exceptions as follows:

(define (call-with-no-exceptions f . ls)
   (with-exception-handler
     (lambda (condition) 'ERR)
     (lambda ()
       (apply f ls))))

and then call it:

(call-with-no-exceptions cons 1 2 3)

to get ERR?

Aziz,,,




More information about the r6rs-discuss mailing list