[Haskell-cafe] Re: [Haskell] Top Level <-

Ganesh Sittampalam ganesh at earth.li
Mon Sep 1 18:08:45 EDT 2008


On Mon, 1 Sep 2008, John Meacham wrote:

> On Mon, Sep 01, 2008 at 10:45:05PM +0100, Ganesh Sittampalam wrote:
>>> Actually all this use of the tainted and derogatory term "global
>>> variable" is causing me to be imprecise. All MVars/IORefs have "global"
>>> main/process scope whether or not they're bound to something at the
>>> top level.
>>
>> "Global variable" is exactly the right term to use, if we are following
>> the terminology of other languages. We don't call the result of
>> malloc/new etc a "global variable", unless it is assigned to something
>> with top-level scope.
>
> global variable is not a very precise term in other languages for
> various platforms too a lot of times.  for instance, windows dll's have
> the ability to share individual variables across all loadings of said
> dll. (for better or worse.)

Interesting, is this just within a single process?

> Haskell certainly has more advanced scoping capabilities than other 
> languages so we need a more refined terminology. I think 'IO scope' is 
> the more precise term, as it implys the scope is that of the IO monad 
> state. which may or may not correspond to some external 'process scope'.

Hmm, to me that implies that if the IO monad stops and restarts, e.g. when 
a Haskell library is being called from an external library, then the scope 
stops and starts again (which I presume is not the intention of <- ?)

But I don't really care that much about the name, if there is consensus on 
what to call it that doesn't cause ambiguities with OS processes etc.

Cheers,

Ganesh


More information about the Haskell-Cafe mailing list