[plt-scheme] Exposing non-exported module variable bindings.

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Dec 17 08:35:28 EST 2003

At Tue, 16 Dec 2003 21:31:55 -0500, "Richard C. Cobbe" wrote:
> > (define-syntax module/expose
> >   (syntax-rules ()
> >     ((_ mod (id1 ...))
> >      (begin
> >        (require mod)
> >        (define-values (id1 ...)
> >          (let ([ns (module->namespace mod)])
> >            (parameterize ([current-namespace ns])
> >              (values 
> >               (namespace-variable-value 'id1 #t void) ...))))))))
> >   
> > (module/expose "mod.scm" (a b)) ;; expose non-provided a and b bindings.
> 
> Unfortunately, this only seems to work if mod is a string; forms like
> (lib "foo.ss" "bar") generate unbound identifier errors for lib.  Is
> there an easy way to get this case to work as well?

I didn't actually try it, but I it looks like adding a quote in the
template would be enough:

                       (module->namespace 'mod)

Matthew



Posted on the users mailing list.