[racket] Submodules can't be imported in same file?
Oh of course, I had inverted the hierarchy of modules. Your way is much
more logical, thanks. I got too sidetracked into what exactly module+
does...
On Fri, Sep 5, 2014 at 6:29 PM, Greg Hendershott <greghendershott at gmail.com>
wrote:
> The following approach works for me. Would that do what you need?
>
> ;; ----- mod.rkt -----
> #lang racket
>
> (module private racket
> (define (secret)
> 'foo)
> (provide secret))
>
> (require 'private)
>
> (define (wrapper)
> (secret))
>
> (provide (all-defined-out))
> ;; Note that all-defined-out will not provide stuff from 'private.
> ;; For that to happen, you would need to use (require (all-from-out
> ;; 'private)). So ... don't do that.
>
>
> ;; ----- use-mod.rkt -----
> #lang racket
>
> (require "mod.rkt")
> (wrapper) ;; => 'foo
> (secret) ;; => error -- as desired
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140905/8e5ab2b7/attachment.html>