[racket] Controlling module bindings with filtered-out?
I originally had something like that in mind, but then I figured that going with a plain `lambda' gives you all of these tweaks that you'd possibly want to do, and while they're a bit more verbose, they have the advantage of being readable without reading up on yet another provide variant. BTW, I'd use a plain `regexp-match' instead of `match' -- seems mentally shorter to me...
On Sep 19, 2011, at 1:18 PM, Danny Yoo <dyoo at cs.wpi.edu> wrote:
> Sometimes I want to write a module language that extends the
> functionality of another, but I want to write that extension in
> racket/base, not in the extending language.
>
> At the moment, I do this like this:
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> #lang racket/base
>
> (require racket/provide
> (for-syntax racket/base)
> (for-syntax racket/match))
>
> (require (prefix-in whalesong-kernel: (planet dyoo/whalesong/lang/kernel)))
> (provide (filtered-out
> (lambda (name)
> (match name
> [(regexp #rx"^whalesong-kernel:(.+)$" (list _ real-name))
> real-name]
> [else
> #f]))
> (all-from-out (planet dyoo/whalesong/lang/kernel))))
>
> ;; definitions/provides for the other language extensions here...
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> This feels verbose, and I imagine that some people do this frequently.
> Is there an easier way to do this?
> _________________________________________________
> For list-related administrative tasks:
> http://lists.racket-lang.org/listinfo/users