[racket] contracts ->i optional keyword syntax

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Aug 27 13:59:57 EDT 2014

Yes, you can refer to non-exported definitions: 

#lang racket

(provide 
 (contract-out 
  (f (-> integer? integer?))))

(define (f x) x)

(define (g x) x)

(module+ test
  (require rackunit (submod ".."))
  
  (check-equal? (f 1) 1)
  (check-equal? (g 1) 1))




On Aug 27, 2014, at 1:02 AM, Kevin Forchione <lysseus at gmail.com> wrote:

> 
> On Aug 26, 2014, at 2:53 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
> 
>> 
>> 
>> We should probably document this little trick somewhere. -- Matthias
> 
> Yes please. It would be useful in the Contract documentation, perhaps as a link pointing to the illustration in the Modules documentation.  So by requiring the enclosing module as a submodule the bindings are redefined (or reinitialized) as specified by the module’s provide? So if the enclosing module didn’t provide certain bindings would the module+ still have access to those bindings from the enclosing module?  
> 
> Also, this seems like such a useful construct that it might be nice to have a shorthand. e.g. (module++ …)? 
> 
> -Kevin



Posted on the users mailing list.