Re: Proposal Summary: Add setEnv/unsetEnv to "base"
Conrad Parker <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.libraries,gmane.comp.lang.haskell.cvs.ghc |
|---|---|
| Message-ID | <CA+FqJiEDvNBK52y4S4pRdLoRyLOo8mw9E9=1S5S+Aiacy9nPog@mail.gmail.com> |
On 19 November 2012 03:43, Simon Hengel <[email protected]> wrote: >> 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 >> systems. > > I finally prepared a patch for "base" [1]. 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. I don't understand why we need the same interface everywhere. Surely we don't want to have a base package that mimics the worst-designed of all systems, and no-one wants to be stuck forever with a big difficult lump of code implementing legacy idiosyncrasies from Windows (which is about as relevant nowadays as VMS). Conrad.