"Simon Marlow" <[EMAIL PROTECTED]> wrote:

> >> The portable interface could be Control.Concurrent.MVar, perhaps.
> 
> I don't really understand the problem, maybe I'm missing something.  I
> thought the idea would be that a thread-safe library would simply use
> MVar instead of IORef.

I was misled by several people's hand-waving assertion that, provided
you used MVars "correctly", there would be no synchronisation problems.
But no-one had yet defined what "correct" meant.  I kind of assumed they
meant you could write concurrent threaded code (with only some minor
restrictions) and have it work in a single-threaded implementation
without change.  This seemed like a pretty strong (and dubious) claim to
me.

But now I see you are actually saying something quite different.  (And I
recall some discussion on these points from a few months ago.)

  * IORef is inherently thread-unsafe, and so we should eliminate IORefs
    from the language.

  * One can write single-threaded code using MVars instead of IORefs,
    and it will be safe on a multi-threaded implementation.

The latter point is quite the opposite of what I thought was being
proposed.

Regards,
    Malcolm
_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://haskell.org/mailman/listinfo/haskell-prime

Reply via email to