[plt-scheme] let-require

From: Synx (plt at synx.us.to)
Date: Mon Nov 2 13:13:59 EST 2009

You know what would be awesome? A syntax that lets you require a module
but limits the lexical scope of its provided names. Something like:

---
(define (make-weird-list a b c)
  (let-require (srfi/1)
    (circular-list a b c)))

(define (circular-list . args)
  (error "Never gets here"))

(make-weird-list 1 2 3)
---

or one thing I was thinking is to allow multiple modules in one file,
yet only the one named according to the file name is available from
external files.

weird-list.ss
---
(module backstage scheme/base
  (require srfi/1)
  (define (make-thing a b c)
    (circular-list a b c))
  (provide make-thing))

(module weird-list scheme/base
  (require backstage)
  (define (main)
    (make-thing 1 2 3))
  (provide main))
---

I like the let-require idea better though. Is there a reason that
require must introduce names at the module's lexical scope? Or is there
a way to do it already that I don't know about?


Posted on the users mailing list.