Haskell 98: Behaviour of hClose

Simon Peyton-Jones simonpj@microsoft.com
Tue, 17 Sep 2002 14:26:54 +0100


Sigbjorn writes:

| Re: your request to have a final look through the report
| for any wibbles that might remain -- Section 11.3.2 of the
| lib report isn't clear on what the expected behaviour of
| (hClose h >> hClose h) ought to be, i.e., will the second
| hClose fail or not?
|=20
| Both GHC and Hugs will now not raise an error when
| an already closed file is closed again.


I'm inclined to agree.  Making hClose on a closed handle into a no-op is
sometimes convenient for the programmer, and not hard for the
implementation to support.  So I propose to specify that in H98.


Meanwhile I only had one reply to this proposed clarification to input
on "stdin":

	If the standard input (stdin) is a terminal device,=20
	any input on stdin is normally echoed on that device

The "normally" clause is a weasel way to say that if you fiddle with the
device then odd things may happen.  The point is that programs like
	do { s <- getLine ; putLine (reverse s) }
should work portably.  If we leave this sentence out, then such programs
are not portable. But they are some of the first programs people write,
so it's important.

In short, I propose to adopt this change unless there's a lot of yelling
soon.

Simon