Proposal Summary: Add setEnv/unsetEnv to "base"
sol at typeful.net
Sun Nov 18 20:43:49 CET 2012
> I propose to add setEnv/unsetEnv to System.Environment, so that it is
> easier to write applications that behave the same on POSIX and Windows
I finally prepared a patch for "base" . Contrary to what I
originally assumed, getting it right on POSIX systems is much harder
than on Windows.
Here is the summary of the discussion:
As I understand it, Duncan Coutts, Gregory Collins, Edward A. Kmett and
Ben Millwood support the proposal.
Gregory Collins noted that
> you can get rid of unsetEnv if you make setEnv take a "Maybe String",
> which might be better. Ultimately though, who cares what color the
> bike shed is painted :)
And I explained that
> on Windows, setEnv "FOO" "" will remove FOO from the environment. I
> don't particularly like it, but as my stated goal was to provide the
> exact same behavior on all platforms and there is no way to work
> around this on Windows my implementation does the same thing.
> People who don't care for Windows support and want to set an
> environment variable to the empty string can still use "unix".
> So short answer: setEnv already supports removing.
> We could still remove unsetEnv from the public interface. I have no
> fixed opinion on that, so I'm very open for suggestions.
Evan Laforge and Wren Thornton then provided valuable feedback on how to
improve the documentation, which I addressed.
There were no major concerns or rejections.
More information about the Libraries