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 <[email protected]> wrote:

> 
> On Aug 26, 2014, at 2:53 PM, Matthias Felleisen <[email protected]> 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


____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to