[racket] Making a contract between a function and "the world in general"
(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
provide-with-whatever-contract-you-already-have
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?)))
(provide/contract
[f primes-to-primes]
[primes-to-primes contract?])
So in some client module we can write
(provide/contract
[f primes-to-primes])
again.
-- Matthias