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

Keean Schupke k.schupke at imperial.ac.uk
Mon Nov 8 05:37:46 EST 2004


Adrian Hey wrote:

>The first step to solving a problem is to at least recognise
>that it exists. What is "bizarre" is that so many folk seem
>to be in denial over this. Perhaps you would like to show
>me your solution to the "oneShot" problem.
>  
>
Why are you unable to give a concrete real world
example of why this is necessary then. Even your
example of real world hardware that must be
initialised once fails! (What if I start two copies
of the program?) With this example the only
satesfactory solution if for the hardware itself
to keep track of when it is initialised. If the hardware
has a "I have been inititalsed" flag, the init
routine would check this flag as its first action and
exit should initialisation already have taken place.
Any other solution is broken in a multi-threaded
environment (or  even a single-threaded one in which
multiple exexutions of the same program are possible
like DOS).

    Keean.



More information about the Haskell mailing list