[racket] Scoped require

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Mon Aug 22 11:11:20 EDT 2011

On Mon, Aug 22, 2011 at 11:05 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
> 4. Since we don't quite understand your actual goal, Carl lists a number of alternatives. One is to locally require a module into a scope definition context:
>
> #lang racket/load
>
> (module names racket/base
>  (provide f)
>  (define (f) (displayln "hello world")))
>
> (module uses racket
>  (require 'names)
>  (let ()
>    (local-require 'names)
>    (f)))
>
> (require 'uses)
>
> But, as it turns out to my surprise, local-require pollutes the global scope:
>
> #lang racket/load
>
> (module names racket/base
>  (provide f)
>  (define (f) (displayln "hello world")))
>
> (module uses-bad racket
>  (require 'names)
>  (f)
>  (let ()
>    (local-require 'names)
>    (f)))
>
> (require 'uses-bad)
>
> Perhaps I just misunderstand.

Why are you using both require and local-require?

--Carl



Posted on the users mailing list.