[plt-scheme] Easy module switching?

From: Dimitris Vyzovitis (vyzo at media.mit.edu)
Date: Thu Jun 28 16:57:43 EDT 2007

On Thu, 28 Jun 2007, Eli Barzilay wrote:

> > I did implement the same interface more than once -- and ended up
> > editing source code.
> >
> > I did consider writing the main script so that it would switch
> > (copy) the module files into the proper location before running the
> > program. But this solution looked so inelegant that I just couldn't
> > bring myself to do it.
>
> How about this:
>
>   (module x mzscheme
>     (define-syntax (env-require stx)
>       (datum->syntax-object
>        stx `(require ,(if (getenv "DEBUG") "x1.scm" "x2.scm")) stx))
>     (env-require)
>     (printf ">>> ~s\n" (foo 1 2)))
>
> ?
>
> (And similar variations -- using `command-line-arguments', making
> `env-require' be like a plain require that shoves "-debug" into the
> file name etc.)
>
> The pitfall here is that this module should not be compiled.

I have used this approach in the past (and its command-line-arguments
siblings), and got bitten in the arse by the compiler too.

It would be nice if there was some way to pass command-line
arguments for transformers through mzc.

Why not add a command line switch to mzc that translates to "put this
to argv/command-line-arguments/compile-time-args-somewhere"?
This would also need a mechanism for propagating through setup-plt to
be effective for libraries.

-- vyzo



Posted on the users mailing list.