[plt-dev] Re: loop over environment variables and delete an environment variable

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Sep 10 22:55:39 EDT 2009

[Moved to plt-dev]

On Sep 10, Peter Michaux wrote:
> On Thu, Sep 10, 2009 at 7:10 PM, Eli Barzilay <eli at barzilay.org> wrote:
> > On Sep 10, Peter Michaux wrote:
> >> It seems that with the exception of using the FFI there currently
> >> is no facility in PLT to either loop over the complete set of
> >> environment variables or delete an environment variable. Is that
> >> a correct conclusion? Is adding that sort of functionality in any
> >> plans?
> >
> > Would you be willing to write the code?
> Will? Yes. Capable? I don't know. I haven't done anything inside the
> MzScheme C code.

The important thing is to see how to make something that runs on
Windows too.

But looking at the code, there is something that looks strange and
might be some old leftover: it looks like if `GETENV_FUNCTION' is not
defined, then there is some environment initialization from an
"Environment" file (which is expected to be in the directory where the
process starts?), and it looks like the code tracks `setenv' uses in
the `putenv_str_table' -- but that doesn't get used unless
`GETENV_FUNCTION' is not defined.  Matthew -- is there a reason for

> Would a function like (environment->alist) be the desirable way to
> access the full environment?

IMO it would be simpler to have a function that returns a list of
environment variable names, but it's probably a good idea to look
around and see what other implementations (and other languages) do.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.