Den tir. 21. jul. 2020 kl. 20.25 skrev Sorawee Porncharoenwase <
[email protected]>:

> This is weird. I usually parameterize current-namespace when using
> namespace-* functions, and in this particular case it works fine.
>
> On Tue, Jul 21, 2020 at 11:05 AM Shriram Krishnamurthi <[email protected]>
> wrote:
>
>> Thank you! Would you know why I might get this error:
>>
>> ; require: unknown module
>>
>> ;   module name:
>>
>> ;     #<resolved-module-path: <<correct path name>>
>>
>> (This is from inside a module.)
>>
>> Trying the same at the REPL, I see the same thing:
>>
>> > (define n (make-base-namespace))
>>
>> > (namespace-require `(file ,(path->string (build-path "wheats"
>> "w1.rkt"))))
>>
>> [note no optional namespace]
>> works fine; the name is available at the top-level; but using the same
>> pathname but with the namespace parameter:
>>
>> > (namespace-require `(file ,(path->string (build-path "wheats"
>> "w1.rkt"))) n)
>>
>> ; require: unknown module
>>
>> ;   module name:
>>
>> ;     #<resolved-module-path: <<correct path name>>
>>
>> (The file in question begins with #lang racket.)
>>
>>

#lang racket

(define ns (make-base-namespace))
(define p  (build-path "/Users/soegaard/tmp" "w1.rkt"))

(parameterize ([current-namespace ns])
  (namespace-require p))

I had to dig up

https://www.mail-archive.com/[email protected]/msg43291.html

to figure it out.

/Jens Axel

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CABefVgyYCFn8%3DVF8Ufr4Q_vwt2nKiTnnk-0t24%3DA%3DmxcSYkKNw%40mail.gmail.com.

Reply via email to