<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 26, 2014, at 10:02 PM, Kevin Forchione <<a href="mailto:lysseus@gmail.com">lysseus@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html charset=windows-1252"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 26, 2014, at 2:53 PM, Matthias Felleisen <<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><br><br style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="font-family: Georgia; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;">We should probably document this little trick somewhere. -- Matthias</span></blockquote></div><br><div>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?  </div><div><br></div><div>Also, this seems like such a useful construct that it might be nice to have a shorthand. e.g. (module++ …)? </div><div><br></div><div>-Kevin</div></div></blockquote></div><br><div>I’ve played around a bit with (module+ …) and can rule out the idea that requiring the enclosing module would limit access to bindings not in the enclosing module’s provide form. But the provide does affect the innings of available within the (module+ …) form. For example:</div><div><br></div><div><div>#lang racket</div><div><br></div><div>(provide (rename-out [foo bar]))</div><div><br></div><div>(define (foo n) n)</div><div><br></div><div>(module+ test</div><div>  (require (submod ".."))</div><div>  (foo 3)</div><div>  (bar 3))</div></div><div><br></div><div>This will return 3 from the foo function and 3 from the bar rename. So it seems logical that the contracts are imported into the module. The question then remains how… The following is interesting:</div><div><br></div><div><div>#lang racket</div><div><br></div><div>(provide (contract-out [foo </div><div>                        (-> string? list?)])</div><div>         (rename-out (foo bar)))</div><div><br></div><div>(define (foo n) (list n))</div><div><br></div><div>(module+ test</div><div>  (require (submod ".."))</div><div>  (foo 3)</div><div>  (bar "3”))</div></div><div><br></div><div>Here foo violates the contract.  Changing the argument to foo to “3” and  the argument to bar to 3 shows that bar does not violate the contract. So the contract is bound to foo and not to the rename. Quite interesting!</div><div><br></div><div>-Kevin</div></body></html>