[racket] web-server/templates: "require: not at module level or top level"

From: Alexander D. Knauth (alexander at knauth.org)
Date: Fri Nov 29 00:11:03 EST 2013

I also tried it with prefix-in and it worked:
#lang racket
(let ()
  (local-require (prefix-in rkt: racket))
  (rkt:string #\a #\b))
;;=> "ab"

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/763de946/attachment.html>

Posted on the users mailing list.