[Haskell-cafe] Re: [Haskell] Top Level <-
Ashley Yakeley
ashley at semantic.org
Wed Sep 3 02:53:34 EDT 2008
Ganesh Sittampalam wrote:
> In any case, what I'm trying to establish below is that it should be a
> safety property of <- that the entire module (or perhaps mutually
> recursive groups of them?) can be duplicated safely - with a new name,
> or as if with a new name - and references to it randomly rewritten to
> the duplicate, as long as the result still type checks.
That's not acceptable. This would cause Unique to break, as its MVar
would be created twice. It would also mean that individual Unique and
IOWitness values created by <- would have different values depending on
which bit of code was referencing them. It would render the extension
useless as far as I can see.
It also introduces odd execution scopes again. In order for <- to work,
it must be understood that a given <- initialiser in a given module in a
given version of a given package will execute at most once per RTS. But
your restriction breaks that.
It's worth mentioning that the current Data.Unique is part of the
standard base library, while hs-plugins is rather experimental.
Currently Data.Unique uses the "NOINLINE unsafePerformIO" hack to create
its MVar. If hs-plugins duplicates that MVar, that's a bug in
hs-plugins. It's up to a dynamic loader to get initialisation code correct.
--
Ashley Yakeley
More information about the Haskell-Cafe
mailing list