I don't think anyone has claimed that any interface can be implemented without globals. Of course some can't (just pick an interface that is the specification of a global variable). What I (and others) claims is that such interfaces are bad. Using a global variable makes an assumption that there's only ever going to be one of something, and that's just an inflexible assumption to make. You think global variables are essential, I think they are a sign of bad design. So we have different opinions and neither one of us is going to convince the other. I think a lot of things related to the IO monad in Haskell is bad design; influenced by imperative thinking. For instance, I think the main function should have a type like main :: (IOMonad io) => io a where IOMonad contains some basic functionality like calling C. Then you could do things like implement runInsandboxIO which traces all C calls. -- Lennart On Thu, Aug 28, 2008 at 5:26 PM, Adrian Hey <ahey@iee.org> wrote:
Jonathan Cast wrote:
On Thu, 2008-08-28 at 10:00 +0100, Adrian Hey wrote:
Lennart Augustsson wrote:
I don't don't think global variables should be banned, I just think they should be severly discouraged.
If you're saying a language should not provide a sound way to do this (as I believe you are), then AFAICT for all practical purposes you *are* saying you think global variables should be banned.
Where are we going to be if the unsafePerformIO hack ever becomes *really* unsafe?
and..
I'm certain you can write a kernel in Haskell where the only use of global variables is those that hardware interfacing forces you to use.
But what you haven't explained is why this is even desirable? I don't doubt it's true in an academic sense if you don't mind sacrificing safety
What `safety' is being sacrificed?
and modularity.
What modularity?
As I've pointed out several times already you can find simple examples in the standard haskell libs. So far nobody has accepted my challenge to re-implement any of these "competantly" (I.E. avoiding the use of global variables).
Why don't you try it with Data.Unique and find out :-)
Regards -- Adrian Hey
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe