<div>Dear list members,</div><div><br></div><div>Can someone explain why in the following cases only two out of the three cases and not all of them cause a contract violation.</div><div>Thanks,</div><div>Harry Spier</div><div>
<br></div><div>#lang racket<br></div>(provide/contract (amount positive?))<br>(define amount -7)<br>><br>contract<br> promised: positive?<br> produced: -7<br> in: positive?<br> contract from: anonymous-module<br> blaming: anonymous-module<br>
<br> BUT--------------------------------------<br> <br> #lang racket<br>(provide/contract [amount (-> positive?)])<br>(define (amount) -7)<br>(amount)<br>><br>No contract violation<br><br>AND-------------------------------------------<br>
<br>#lang racket<br> <br>(provide/contract [amount (-> positive?)])<br>(define (amount) -7)<br><br>(module* main racket<br> (require (submod ".."))<br> (amount))<br><br> ><br> amount: broke its contract<br>
promised: positive?<br> produced: -7<br> in: the range of<br> (-> positive?)<br> contract from: <br> c:\users\harry\ocr_project\contract-test.rkt<br> blaming: <br> c:\users\harry\ocr_project\contract-test.rkt<br>
at: c:\users\harry\ocr_project\contract-test.rkt:3.20<br>