[plt-scheme] should mzscheme -ue work?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jan 23 07:58:13 EST 2009

At Thu, 22 Jan 2009 23:28:21 -0500, "David T. Pierson" wrote:
> $ cat foo.ss
> #lang scheme
> (provide bar)
> (define (bar)
>   (display 'foo))
> $ mzscheme -ue foo.ss '(bar)'
> #f::0: compile: bad syntax; function application is not allowed, because no 
> #%app syntax transformer is bound in: (bar)

When a `require' flag like `-u' appears first, then it disables the
normal require of `scheme' into the top-level environment. This rule
tends to do the right thing for all sorts of cases, but it isn't what
you wanted in this case.

I see three alternatives:

 * Use `-e' to require "foo.ss", as you figured out:

     mzscheme -e '(require (file "foo.ss"))' -e '(bar)'

 * Use an `eval'-like flag before `-u':

     mzscheme -eue '(void)' foo.ss '(bar)'

 * Change "foo.ss" to re-export `scheme':

     #lang scheme
     (provide bar (all-from-out scheme))
     (define (bar)
       (display 'foo))

> $ mzscheme -u foo.ss -e '(bar)'

The `-u' flag also causes all later command-line arguments to be
treated as non-flags. So, "-e" and "(bar)" are put into
`current-command-line-arguments' instead of handled by `mzscheme'.


Posted on the users mailing list.