Use (define/contract...

to enforce a contract within a module

(define/contract  (amount) 
  (-> positive?)
  -7)

#|
  amount: broke its contract
  promised: positive?, produced: -7
  in: the range of
      (-> positive?)
  contract from: (function amount)
  blaming: (function amount)
  at: unsaved-editor34887:5.19

|# 

and use (provide/contract

to enforce across module boundaries but not within a module

As a practical matter, I use the (define/contract form and the (provide form
[not (provide/contract]

to enforce contracts both within and without a module


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to