> On Mon, 2002-03-18 at 18:30, Simon Marlow wrote:
> > The spec could perhaps *require* that it was a pure value,
> so that the
> > file contents is snapshotted at the time of the hGetContents and you
> > always get the same result regardless of subsequent or
> concurrent I/O
> > operations. This can perhaps be implemented with
> copy-on-write if the
> > OS supports it, but I don't know if any OSs actually do.
>
> The mmap system call provides this, on Unix systems. The man page says
> it's POSIX.1b standard, so it might even be supported by Windows 2000.
I don't think mmap() provides exactly the right behaviour. It lets you
specify that modifications made by the current process aren't committed
to the file, but what we want is to snapshot the file so that subsequent
modifications by *other* processes aren't seen by the local process.
> This strategy won't work for general IO streams (pipes,
> sockets...), of
> course. If the spec would require all stream contents to behave like
> pure values, this would limit lazy streams to files. So you could no
> longer handle general streams and files the same way...
These kinds of streams are immutable, so the problem is less severe. We
don't have to worry about the interaction with other processes.
Cheers,
Simon
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs