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

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Mon Nov 26 13:44:11 EST 2012

On 11/24/2012 09:13 PM, Harry Spier wrote:
> About a year ago, there was a discussion on the list about "provide"
> propagating existing contracts.
> (See: http://www.mail-archive.com/users@racket-lang.org/msg08623.html )
> suggested by Neil Toronto for this reason:
> "...define/contract has a huge advantage that contract-out doesn't have:
> it puts all the invariants at the function definition, right before the
> code that relies on them. "
> and with this suggested form:
> ----------
>    (provide (contract-out real-id))
>    ; ... more code ...
> (define/contract (real-id x) (real? . -> . real?)
> x)
> Or (provide (lift-contract real-id)) might be even better.
> ------------
> AFAICT the discussion seemed somewhat favorable to this.  What is the
> status of this?  Are there any plans to implement this (or something
> like this)?

There's a partial implementation of this idea as recontract-out from 
unstable/recontract. It doesn't work with define/contract, though; you 
can only recontract something imported from another module. I haven't 
looked at define/contract yet to see how difficult it would be to 
support it too.


Posted on the users mailing list.