On 07 December 2005 13:38, Malcolm Wallace wrote: > Jan-Willem Maessen <[EMAIL PROTECTED]> writes: > >> - Fetch elimination for imperative reads: >> writeIORef r e >> acts >> readIORef r >> === writeIORef r e >> acts >> return e > > This transformation is valid only on single-threaded systems. > If there is any possibility of an IORef being shared across threads, > you are out of luck.
(assuming 'acts' doesn't modify 'r'). No, Jan's transformation is correct even in a multithreaded setting. It might eliminate some possible outcomes from a non-deterministic program, but that's ok. There's no requirement that all interleavings according to the semantics have to be implemented. This is a hard property to state precisely, indeed we gave up trying to in the concurrency/FFI paper: http://www.haskell.org/~simonmar/papers/conc-ffi.pdf, see Section 6.1. Cheers, Simon _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users