Can you say more about how you're running this program? I get `42` all
four times when running this program with `racket` or in DrRacket.

At Thu, 17 Sep 2015 00:08:00 -0400, Greg Hendershott wrote:
> I'm working on adding better submodule support in racket-mode, which
> entails using module->namespace.
> 
> This works with `module` and the non-#f variant of `module*`, but
> fails with the #f variant of `module*` and equivalently `module+`.
> 
> A distilled example program below shows the first two working and the
> last two not.
> 
> Am I wrong to expect it to work?
> 
> 
> #lang racket/base
> 
> (require syntax/location)
> 
> (define (eval-x-in-submodule-namespace mod-path)
>   (dynamic-require mod-path #f)
>   (define ns (module->namespace mod-path))
>   (eval 'x ns))
> 
> (module sub/module racket/base
>   (define x 42))
> (eval-x-in-submodule-namespace (quote-module-path sub/module))
> ; => 42
> 
> (module* sub/module*/racket/base racket/base
>   (define x 42))
> (eval-x-in-submodule-namespace (quote-module-path sub/module*/racket/base))
> ; => 42
> 
> (module* sub/module*/#f #f
>   (define x 42))
> (eval-x-in-submodule-namespace (quote-module-path sub/module*/#f))
> ; x: undefined;
> ;  cannot reference an identifier before its definition
> ;   in module: (submod "/tmp/sub.rkt" sub/module*/#f)
> 
> ;; Equivalently
> (module* sub/module+ #f
>   (define x 42))
> (eval-x-in-submodule-namespace (quote-module-path sub/module+))
> ; x: undefined;
> ;  cannot reference an identifier before its definition
> ;   in module: (submod "/tmp/sub.rkt" sub/module+)
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to