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
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to