Top Level TWI's again was Re: [Haskell] Re: Parameterized Show
benjamin.franksen at bessy.de
Mon Nov 22 11:03:30 EST 2004
On Monday 22 November 2004 09:38, Adrian Hey wrote:
> On Friday 19 Nov 2004 2:27 pm, Benjamin Franksen wrote:
> > But toplevel
> > things with identity (TWI) are evil as well, *especially* if they are
> > easy to use.
> Just repeating this again and again doesn't make it any more true. Neither
> you or any of the other nay-sayers have provided any evidence or credible
> justification for this assertion, nor have any of you provided any workable
> alternative for even the simplest example.
This is getting ridiculous. At least two workable alternatives have been
- C wrapper (especially if your library is doing FFI anyway)
- OS named semaphores
Further, as for "evidence or credible justification" for the my claim, you can
gather it from the numerous real-life examples I gave, and which you chose to
ignore or at least found not worthy of any comment. Of course, these examples
are only annecdotal, but I think this is better than a completely artificial
requirement (like your "oneShot").
You have been asked more than once to present a *real-life* example to
(a) global variables are necessary (and not just convenient),
(b) both above mentioned alternatives are indeed unworkable.
> You have yet to
> explain how you propose to deal with stdout etc..
I see absolutely no reason why stdxxx must or should be top-level mutable
objects. They can and should be treated in the same way as environment and
command line arguments, i.e.
getArgs :: IO [String]
getEnv :: String -> IO String
getStdin, getStdout, getStderr :: IO Handle
Note that (just like environment and command line arguments) these handles may
refer to completely different things on different program runs.
Top level things with identity are evil. -- Lennart Augustsson
More information about the Haskell