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

From: Michael Sperber <sperber>
Date: Wed Nov 1 01:36:46 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? From what I understand
> from this thread so far, the above is not a correct program and thus
> is meaningless (it may be rejected by some implementations, may return
> 1 under others, and may return (1 . 2) under a third).

In safe mode, it returns 1 by virtue of the following wording (Section
5.1):

 Also, if the number of arguments provided in a procedure call does
 not match any argument count specified for the called procedure, an
 exception with condition type {\cf\&contract} must be raised.

> If the above *is* a correct program that returns 1, then I need
> further explanation of its meaning when run under an "unsafe"
> declaration.

In unsafe mode, all bets are off by virtue of the following wording
(as an example) (Section 4.3):

 In \textit{unsafe} code, implementations might not raise the
 exceptions that are normally raised in those situations.

-- 
Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla
Received on Wed Nov 01 2006 - 01:36:34 UTC

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