[Haskell-cafe] Re: [Haskell] Re: Global Variables and IO initializers

Adrian Hey ahey at iee.org
Sun Nov 7 17:41:11 EST 2004


On Sunday 07 Nov 2004 6:19 pm, Benjamin Franksen wrote:
> On Sunday 07 November 2004 17:41, Keean wrote:
> > I might really want to call the initialisation twice. If you use global
> > variables, the library can only be initialised once... but what if I
> > really want to use the library twice? With the state in a type passed
> > between functions, you can have multiple different states active
> > at once.
>
> Yes, exactly. Just as you might, in fact, *want* to call putString twice...

Exactly wrong. I have stated several times that realInit cannot be used
more than once, and this fact is the reason for the existance of oneShot.

I don't want to get to hung up on this one simple example (heaven knows
there are plenty of other possible examples), but I'm still waiting for
yourself or Keean to demonstrate a simpler and safer way of ensuring this,
not waffle your way out by saying it's unnecessary. I can assure you it
is necessary.

Oh and while we're at it, perhaps one of you could explain what it is
you think is unsafe about the hypothetical top level <- bindings we're
discussing (I've asked this before too, but no answer has been provided).

Are your objections dogmatic, aesthetic, or rational?

Do either of you object to the existance of such things as stdout?

Or are you happy with their existance and it's just their safe creation
you object to? If so, this seems like a strange contradiction to me.

Regards
--
Adrian Hey



More information about the Haskell-Cafe mailing list