Ganesh Sittampalam wrote:
By global scope, I mean the largest execution scope an IORef created by newIORef can have. Each top-level IORef declaration should create an IORef at most once in this scope.

That's a reasonable definition, if by "execution scope" you mean your previous definition of "where the IORef can be directly used". But it's not process scope; two independent Haskell libraries in the same process can no more share IORefs than two separate Haskell processes.

[what I meant by global scope above was "the entire world"]

OK. Let's call it "top-level scope". Haskell naturally defines such a thing, regardless of processes and processors. Each top-level <- would run at most once in top-level scope.

If you had two Haskell runtimes call by C code, each would have its own memory allocator and GC; IORefs, Uniques and thunks cannot be shared between them; and each would have its own top-level scope, even though they're in the same process.

--
Ashley Yakeley
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to