[racket] Scoped require

From: Maxim Romashchenko (max at anahoret.com)
Date: Mon Aug 22 10:04:46 EDT 2011

Hello.

Thank you for your reply, Eli.
It looks like I need to state my question more clearly.

The trick I'm looking for is how to create a quasi-begin form inside 
which you can use all the other symbols defined in the module, while 
those symbols are not imported into top-level. In fact the only thing 
added to the top level is supposed to be the quasi-begin form itself.

Best regards, Maxim.


On 2011-08-22 16:04, Eli Barzilay wrote:
> 50 minutes ago, Maxim Romashchenko wrote:
>>
>> --- my-module.rkt ---
>> #lang racket
>> (provide my-begin)
>>
>> (define foo
>>     ...
>> ---------------------
>
> You could do this:
>
>    #lang racket
>    (provide (rename-out [begin my-begin]))
>
> and get what you want,
>
>> --- main.rkt ---
>> #lang racket
>> (require "my-module.rkt")
>>
>> (my-begin
>>     (foo
>>       ...
>> -----------------
>
> but it's probably easier to do this instead here:
>
>    #lang racket
>    (require (rename-in racket [begin my-begin]))
>


Posted on the users mailing list.