[Haskell-cafe] global variables

Simon Marlow simonmarhaskell at gmail.com
Thu May 24 11:30:34 EDT 2007


Adrian Hey wrote:
> 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.

This is going to be highly subjective, but to me it still doesn't feel like it 
falls under the bar for implementation cost given its usefulness.

The new syntax requires additions all the way through the front end of the 
compiler: parser, abstract syntax, renamer, type checker, desugarer, for 
something that is rarely used.  It's a first-class language construct (a new 
top-level binding form, no less), and it has to pay its way.  Also you want to 
add the ACIO monad as a built-in to the language.

Not that my gut feeling should in any way be considered the final word on the 
subject, but I thought I should say something about why we're not running to 
implement this right now.  To me it seems like we should let it simmer some more.

Cheers,
	Simon



More information about the Haskell-Cafe mailing list