[racket-dev] Feature request - contract form that splits provide/contract into two parts

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Dec 28 09:42:36 EST 2012

On Dec 27, 2012, at 8:58 PM, Harry Spier wrote:

> On Fri, Dec 14, 2012 at 10:44 AM, Matthias Felleisen
> <matthias at ccs.neu.edu> wrote:
>> 
>> It is critical to inform clients of the services that a module
>> provides. In the absence of types, contracts are the closest
>> information we have.
> AND
> On Fri, Dec 14, 2012 at 11:43 AM, Ray Racine <ray.racine at gmail.com> wrote:
>> For the TR folks you can have your cake and eat it with a cup of coffee with
>> `provide'.  TR Rules
> 
> Given the above, should you be using Typed Racket instead of contracts
> whenever possible?  Are there cases where if you have the choice you
> should prefer contracts instead of using Typed Racket


No for several reasons: 

1. Our contracts are actually more powerful than our types: 

 see http://www.ccs.neu.edu/home/matthias/Style/style/Units_of_Code.html#(part._.Contracts)

especially contract for celsius->fahrenheit for an example. 
(In principle, our type system can express this idea.) 

2. We see Racket as a continuum: 
 -- write a script, throw it away 
 -- or grow the script/create prototype with informal contracts and data descriptions
 -- if you like your prototype and you know it'll be around for a while, 
	turn informal contracts into checked contracts
	weighing performance impact against importance of checks. 
 -- if you ever maintain any of these modules, split contracts into types and residual contracts. 
	Problem: we still don't have contract-out for TR	
	So you will need to turn contracts into types and throw away residual contracts. 

One day SAM will get around to this gap. 

3. Of course, you should know which entry point is best for you 
and choose for yourself at which level you wish to enter. The 
point is

  with Racket, you have this choice

(and with other languages, you don't.) -- Matthias



Posted on the dev mailing list.