[racket] Why this contract violation behaviour?
Dear list members,
Can someone explain why in the following cases only two out of the three
cases and not all of them cause a contract violation.
Thanks,
Harry Spier
#lang racket
(provide/contract (amount positive?))
(define amount -7)
>
contract
promised: positive?
produced: -7
in: positive?
contract from: anonymous-module
blaming: anonymous-module
BUT--------------------------------------
#lang racket
(provide/contract [amount (-> positive?)])
(define (amount) -7)
(amount)
>
No contract violation
AND-------------------------------------------
#lang racket
(provide/contract [amount (-> positive?)])
(define (amount) -7)
(module* main racket
(require (submod ".."))
(amount))
>
amount: broke its contract
promised: positive?
produced: -7
in: the range of
(-> positive?)
contract from:
c:\users\harry\ocr_project\contract-test.rkt
blaming:
c:\users\harry\ocr_project\contract-test.rkt
at: c:\users\harry\ocr_project\contract-test.rkt:3.20
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121116/5fcabe7d/attachment-0001.html>