[plt-dev] Re: Generated files and co-existing copies of DrScheme

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Nov 21 12:04:13 EST 2009

At Fri, 20 Nov 2009 15:51:19 -0500, Eli Barzilay wrote:
> Look, the story with environment variables vs command-line flags is
> esentially the same one as with keyword arguments vs parameters.

I completely agree. But how does this lead you to the conclusion that
environment variables are bad?


At the Scheme level, we always prefer to use function arguments instead
of parameters. But threading some configuration information everywhere
(such as the current output port) is a huge pain. So we have
parameters, and various functions accept an optional argument whose
default value is drawn from a parameter.

Similarly, the -X and -S arguments were not added to `mzscheme' because
environment variables are an inherently bad idea. They were added
because it's better to supply those configurations directly when
practical. But the environment variables stayed, because it's not
always practical to thread a command-line argument through a chain of
scripts.

> Another problem with environment variables is that they get passed on
> in strange ways.  I've seen people hopelessly confused on Windows,
> since changing the environment is done in an awkward way.

The same with parameters, but we'd have a hard time getting by without
them.


It looks to me like a PLTADDONDIR environment variable is appropriate,
and `mzscheme' should also accept a command-line flag to override it.



Posted on the dev mailing list.