[racket] submodule/local-require question
The code you gave doesn't seem to work either. After saving your code in a file named test-n.rkt, and running it, I get the following error:
Welcome to DrRacket, version 5.3.4 [3m].
Language: racket; memory limit: 256 MB.
. . ../../../../Applications/Racket v5.3.4/collects/errortrace/errortrace-lib.rkt:434:2: require: unknown module
module name: #<resolved-module-path:(submod 'test-n A)>
>
On Jul 14, 2013, at 4:56 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> At Sun, 14 Jul 2013 12:50:32 -0600, Christopher wrote:
>> #lang racket
>>
>> (module A racket
>> (provide x)
>> (define x #t) )
>>
>> (let []
>> (local-require 'A)
>> x )
>
> The '-based shorthand for submodules only works in certain situations. (Generalizing that has been on my to-do list for a long time.)
>
> For now, you have to use the longer `(submod "." A)' form:
>
> #lang racket
>
> (module A racket
> (provide x)
> (define x #t))
>
> (let []
> (local-require (submod "." A))
> x)
>