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

From: Dor Kleiman (dor at ntr.co.il)
Date: Wed Dec 17 08:42:17 EST 2003

Why would you want to expose those variables anyway?
If for using them in code, it sounds quite wrong to do it.
If for debugging, they are exposed anyway when using the module
language...


-----Original Message-----
From: Matthew Flatt [mailto:mflatt at cs.utah.edu] 
Sent: Wednesday, December 17, 2003 3:35 PM
To: Richard C. Cobbe
Cc: Raymond Racine; plt-scheme at list.cs.brown.edu
Subject: Re: [plt-scheme] Exposing non-exported module variable
bindings.

  For list-related administrative tasks:
  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

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.