Global variables?

Andrew J Bromage
Mon, 3 Feb 2003 10:53:31 +1100

G'day all.

On Fri, Jan 31, 2003 at 01:54:26PM -0600, Jon Cast wrote:

> Otherwise, though, see my other post on this subject: unsafePerformIO
> will perform its action when the variable is accessed, so you can't
> write a Haskell program which differentiates between what any compiler
> actually does and running the variable allocations before main.

As has been pointed out, there is no language requirement for a
Haskell implementation to be "fully lazy".  In particular, it is
technically possible for an implementation to garbage collect
globalVar and re-evaluate it on the next call.

Haskell 2 should probably have a pragma controlling this.

Andrew Bromage