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

Michael Sperber sperber at informatik.uni-tuebingen.de
Thu Nov 2 04:41:03 EST 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



More information about the r6rs-discuss mailing list