[racket] Making a contract between a function and "the world in general"

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Oct 8 12:12:25 EDT 2011

(1) I do not understand Neil's problem. Say I have module A and 
want to protect its exports from abuses by clients, say module B,
why do you use define/contract at all? The define/contract form 
is for splitting modules into module-lets -- in case your module
is too large and you can't manage invariants in your head. If you
believe that this is true for even small modules, I urge you to 
use Typed Racket. That's the better solution and real soon now
TR will allow you to add contracts on top of types at provides. 
Right Sam? 

(2) I object to 


because I think programmers should explicitly state what 
they want (if they want something logical). 

We can already do this 

 (define primes-to-primes (-> (listof prime?) (listof prime?)))

   [f primes-to-primes]
   [primes-to-primes contract?])

So in some client module we can write 

   [f primes-to-primes])


-- Matthias

Posted on the users mailing list.