FW: lazy file reading in H98
Simon Marlow
simonmar@microsoft.com
Tue, 3 Apr 2001 17:21:24 +0100
> > (1) At least, the definition should say that the behaviour
> > is undefined if a program ever writes to a file that it
> > has read with `readFile' or `hGetContents' before.
>=20
> The Library Report is already stronger than this.
Yes, but the behaviour specified by the report isn't exactly useful.
The problem is that a semi-closed handle becomes fully closed at some
random point in the future, when the list returned from readFile is
fully evaluated. In order to make sure that a subsequent writeFile
won't fail due to a locking violation, you have to fully force the
string returned from readFile.
Incedentally, nhc98 doesn't seem to implement the locking (perhaps this
is a known bug, I didn't check).
Cheers,
Simon