[racket] submodule paths and DrRacket

From: Harry Spier (vasishtha.spier at gmail.com)
Date: Sun Nov 18 21:10:25 EST 2012

Dear list members,

Can someone explain the following behavior

Case 1 as follows works in the DrRacket Definitions window but doesn't work
in the Interactions window
#lang racket
(module m racket
(provide color)
(define color "blue"))

(module n racket
(require (submod ".." m))
(printf "my favorite color is ~a\n" color))

Case 2 as follows works in the DrRacket Interactions window but doesn't
work in the Definitions window
> (module m racket
(provide color)
(define color "blue"))

(module n racket
(require 'm)
(printf "my favorite color is ~a\n" color))
(require 'n)

I'm clear why in case 1    (submod ".." m) resolves to submodule m when the
code is in the definitions window, but I'm not clear why it doesn't do so
 when the code is in the Interactions window.

I'm also not clear why case 2 works in the Interactions window.  I.e.  I'm
not clear why in case 2 in the interactions window (require 'm), which
 according to the Racket Guide expands to (require (submod "." m)  works
and (require (submod ".." m) doesn't work for this case.

Also is there a way to have
    #lang racket
     (module m racket
     (provide color)
     (define color "blue"))

in the definitions window but the following in the interactions window

     >(module n racket
     (require SOME SUBMODULE PATH TO m)
      (printf "my favorite color is ~a\n" color))
      (require 'n)

and have it work.

Thanks,
Harry Spier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121118/d4d7ab64/attachment.html>

Posted on the users mailing list.