<div dir="ltr"><div>Thanks for the explanation!<br><br></div>Laurent<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 10, 2014 at 12:50 PM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think the ordering of submodules is unavoidable, but the<br>
documentation should make more clear that the order of `module*`<br>
declarations matters.<br>
<br>
Meanwhile, the documentation for `module+` needs to clarify that it<br>
puts the generated `module*` at the end of the enclosing module, even<br>
if there's only one `module+` form for a module name. It should also<br>
say that the order of the generated `module*`s for multiple<br>
`module+`-based modules corresponds to the order of the initial<br>
`module+` for each name (which turns out to be an explicit choice, as<br>
opposed to an accident of the implementation).<br>
<div><div class="h5"><br>
At Tue, 1 Jul 2014 10:16:06 +0200, Laurent wrote:<br>
> Hi,<br>
><br>
> I'm using `(module+ plot)` to avoid loading the `plot` library when<br>
> requiring the enclosing module only.<br>
><br>
> But it seems that `module+` is dependent on the order of the modules,<br>
> somewhat contrarily to `module*`. For example, this works:<br>
> #lang racket<br>
><br>
> (define x 3)<br>
><br>
> (module+ foo<br>
> (provide y)<br>
> (define y x))<br>
><br>
> (module+ test<br>
> (require (submod ".." foo))<br>
> y)<br>
><br>
> But this does not:<br>
> #lang racket<br>
><br>
> (define x 3)<br>
><br>
> (module+ test) ; *** ADDED<br>
><br>
> (module+ foo<br>
> (provide y)<br>
> (define y x))<br>
><br>
> (module+ test<br>
> (require (submod ".." foo))<br>
> y)<br>
><br>
> But this works:<br>
> #lang racket<br>
><br>
> (define x 3)<br>
><br>
> (module+ test)<br>
><br>
> (module* foo #f ; *** CHANGED<br>
> (provide y)<br>
> (define y x))<br>
><br>
> (module+ test<br>
> (require (submod ".." foo))<br>
> y)<br>
><br>
> And this works too:<br>
> #lang racket<br>
><br>
> (define x 3)<br>
><br>
> (module+ foo) ; *** ADDED<br>
> (module+ test)<br>
><br>
> (module+ foo ; ***<br>
> (provide y)<br>
> (define y x))<br>
><br>
> (module+ test<br>
> (require (submod ".." foo))<br>
> y)<br>
><br>
> I want to use `module+` over `module*` for its concatenation capability,<br>
> and adding a `(module+ foo)` at the top of my file is no big deal, but,<br>
> since the docs do not talk about some order dependency of submodules<br>
> (AFAICT) and only say that `module+` is equivalent to `module*` with #f and<br>
> concatenation, I was wondering if this was the intended behavior.<br>
><br>
> Actually, `module*` also seems to be dependent of the order, as the<br>
> following does not work:<br>
> #lang racket<br>
><br>
> (define x 3)<br>
><br>
> (module* test #f<br>
> (require (submod ".." foo))<br>
> y)<br>
><br>
> (module* foo #f<br>
> (provide y)<br>
> (define y x))<br>
><br>
> From this I infer that the modules declared by `module+` are collected in<br>
> order of their first appearance and declared at the end of the module in<br>
> this same order, therefore after all `module*`. Is this correct?<br>
><br>
> And is it easy enough to have order independence for both `module+` and<br>
> `module*`, and would it be a good idea in general?<br>
><br>
> Laurent<br>
</div></div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br></div>