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

From: Abdulaziz Ghuloum <aghuloum>
Date: Thu Oct 26 15:42:20 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,,,
Received on Thu Oct 26 2006 - 15:42:21 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC