[racket] web-server/templates: "require: not at module level or top level"
Also, this produces an error saying it's an unknown module if it's a
local-require:
#lang racket
(module thing racket
(provide x)
(define x "something"))
(let ()
(local-require 'thing)
x)
;;=>
;; ../../Applications/Racket v5.3.4/collects/racket/private/
reqprov.rkt:1092:2: require: unknown module
;; module name: #<resolved-module-path:'thing>
But this works fine:
#lang racket
(module thing racket
(provide x)
(define x "something"))
(require 'thing)
x
;;=> "something"
On Nov 28, 2013, at 9:32 AM, Greg Hendershott wrote:
> It looks like there's a corner case where `local-require` does not
> work -- with non-simple require specs such as `rename-in` or
> `prefix-in`, AND where the module is the #lang module.
>
> This works with normal require:
>
> #lang racket
> (require (rename-in racket [string rkt:string]))
> (rkt:string #\a #\b) ;=> "ab"
>
> But this does not:
>
> #lang racket
> (let ()
> (local-require (rename-in racket [string rkt:string]))
> ;;=> 3:28: syntax: misplaced ellipsis in template at: ... in: ...
> (rkt:string #\a #\b))
>
> Something like...
>
> #lang racket
> (let ()
> (local-require (rename-in net/url [get-pure-port foo]))
> ...
>
> ...does compile OK. So it seems specific to it being the #lang or
> perhaps specific to `racket`.
>
> I'll report this as a not-critical bug. (Even if it's not a bug in the
> sense that there's a good reason why it ought not to work? The error
> message could be better and/or the docs for local-require might
> explain this.)
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20131129/87b2e15e/attachment-0001.html>