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

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Dec 14 12:21:55 EST 2012

Thou shall not copy code. 


You should 

(define-type i2i (Integer -> Integer)) 

so that you don't have to repeat the type. 


On Dec 14, 2012, at 11:43 AM, Ray Racine wrote:

> For the TR folks you can have your cake and eat it with a cup of coffee with `provide'.  TR Rules
> 
> #lang typed/racket/base
> 
> ;;public interface/w specifications
> (provide:
>   [inc (Integer -> Integer)])
> 
> ...
> 
> (: inc (Integer -> Integer))
> (define (inc x) (add1 x))
> 
> 
> ...
> 
> 
> 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. Reading the implementation is against
> all good SE ideas.
> 
> IF we could assume that people always programmed in DrRacket,
> we could compromise and add a tool that synthesizes the interface
> of a module in some way. Since some contributors break this guideline
> all the time anyway, we should have such a tool available anyway.
> 
> BUT there are also people who use Emacs and the other editor.
> 
> So, if you want to be good, put provide contract-out at the top
> of your module.
> 
> 
> 
> 
> 
> On Dec 14, 2012, at 1:02 AM, Harry Spier wrote:
> 
> > If you place provide/contract at the beginning of a module it makes
> > the interface clear but it is separated from its function.  If you
> > place it right before its function and not at the top of the module,
> > it makes the function clearer but the module interface is not so
> > clear.
> >
> > Is it possible (would it be a good idea?) to provide a new form that
> > splits the provide/contract form into two parts.  One part the
> > contract definition which you could place immediately before the
> > function definition and the second part a provide spec for inclusion
> > in a provide statement that included the function name but not the
> > contract spec.) .  That way the contract definition can be by the
> > function definition and the function name can be in a provide
> > statement at the beginning of the module.
> >
> > Harry Spier
> > _________________________
> >  Racket Developers list:
> >  http://lists.racket-lang.org/dev
> 
> _________________________
>   Racket Developers list:
>   http://lists.racket-lang.org/dev
> 



Posted on the dev mailing list.