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

From: Michael Sperber <sperber>
Date: Thu Nov 2 04:41:13 2006

Abdulaziz Ghuloum <aghuloum_at_cs.indiana.edu> writes:

> On Oct 31, 2006, at 11:49 AM, Michael Sperber wrote:
>
>> It almost says that it produces a particular result at run time. I
>> suspect whoever wrote this originally wanted to write:
>>
>> (call-with-current-continuation
>> (lambda (exit)
>> (with-exception-handler (lambda (x) (exit 1) (lambda () (cons 1
>> 2 3))))))
>>
>> which returns 1.
>
> Are you sure this program should return 1?

Of course not, now that Will and you have pointed out I misread it.
This is the program you mean, right?

(call-with-current-continuation
  (lambda (exit)
    (with-exception-handler
      (lambda (x)
        (exit 1)
        (lambda () (cons 1 2 3))))))

This program calls `with-exception-handler' with an invalid number of
arguments, and thus leads to an exception with condition type
&contract.

This program is the one that I really wanted to write:

(call-with-current-continuation
  (lambda (exit)
    (with-exception-handler
      (lambda (x)
        (exit 1))
      (lambda () (cons 1 2 3)))))

and it returns 1.

-- 
Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla
Received on Thu Nov 02 2006 - 04:41:03 UTC

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