[Haskell-cafe] global variables

Adrian Hey ahey at iee.org
Thu May 24 03:15:54 EDT 2007


Taral wrote:
> On 5/23/07, Adrian Hey <ahey at iee.org> wrote:
>> I think I still prefer..
>>
>> var :: IORef Int
>> var <- newIORef 3
> 
> So do I. For one very good reason: this syntax could be defined as a
> "constructor" syntax and guaranteed to run before main.

Or even at compile time (which is why I think it's reasonable to
regard operations like newIORef etc.. as not really being "IO"
operations at all). But anyway, the constraints of the ACIO monad
allow creation to occur at any time before the first attempt to
read or write the IORef.

> The other syntaxes proposed don't strike me as sufficiently rigorous.

Me neither. It's always been a great source of puzzlement to me why this
very simple and IMO conservative proposal should be so controversial.
Unless someone can point out some severe semantic difficulty or suggest
something better it seems like a no-brainer to me.

Regards
--
Adrian Hey





More information about the Haskell-prime mailing list