[racket] Controlling module bindings with filtered-out?

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Mon Sep 19 14:18:31 EDT 2011

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?


Posted on the users mailing list.