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

Ashley Yakeley ashley at semantic.org
Sat Aug 30 07:05:22 EDT 2008


Ganesh Sittampalam wrote:
> If you want to standardise a language feature, you have to explain its 
> behaviour properly. This is one part of the necessary explanation.
> 
> To be concrete about scenarios I was considering, what happens if:
> 
>  - the same process loads two copies of the GHC RTS as part of two 
> completely independent libraries? For added complications, imagine that 
> one of the libraries uses a different implementation instead (e.g. Hugs)
> 
>  - one Haskell program loads several different plugins in a way that 
> allows Haskell values to pass across the plugin boundary
> 
> How do these scenarios work with use cases for <- like (a) Data.Unique 
> and (b) preventing multiple instantiation of a sub-library?

That's a good question. But before you propose these scenarios, you must 
establish that they are sane for Haskell as it is today.

In particular, would _local_ IORefs work correctly? After all, the 
memory allocator must be "global" in some sense. Could you be sure that 
different calls to newIORef returned separate IORefs?

Perhaps this is the One True Global Scope: the scope in which refs from 
newIORef are guaranteed to be separate. It's the scope in which values 
from newUnique are supposed to be different, and it would also be the 
scope in which top-level <- would be called at most once.

-- 
Ashley Yakeley


More information about the Haskell-Cafe mailing list