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

From: Alexander D. Knauth (alexander at knauth.org)
Date: Thu Nov 28 21:04:42 EST 2013

Oops I left the other comment in.  I meant:

I tried it with only-in instead of rename-in and it worked:
#lang racket
(let ()
  (local-require (only-in racket [string rkt:string]))
  (rkt:string #\a #\b))
;;=> "ab"

On Nov 28, 2013, at 8:50 PM, Alexander D. Knauth wrote:

> I tried it with only-in instead of rename-in and it worked:
> #lang racket
> (let ()
>  (local-require (only-in racket [string rkt:string]))
>  ;;=> 3:28: syntax: misplaced ellipsis in template at: ... in: ...
>  (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
>
> ____________________
>  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/20131128/3ce4e609/attachment-0001.html>

Posted on the users mailing list.