[plt-scheme] let-require
PLaneT is an underutilized treasure trove. The model makes it easy for
great contributions; but who knows about them?
On Mon, Nov 2, 2009 at 12:24 PM, Carl Eastlund <carl.eastlund at gmail.com> wrote:
> I provide this in a planet package:
>
> --
> #lang scheme
>
> (require (planet cce/scheme:6))
>
> (define (make-weird-list a b c)
> (local-require srfi/1)
> (circular-list a b c))
>
> (define (circular-list . args)
> (error "Never gets here"))
>
> (make-weird-list 1 2 3)
> --
>
> Carl Eastlund
>
> On Mon, Nov 2, 2009 at 1:13 PM, Synx <plt at synx.us.to> wrote:
>>
>> 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?
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
--
http://www.wisdomandwonder.com/