Haskell 98: Behaviour of hClose

Simon Peyton-Jones simonpj@microsoft.com
Wed, 18 Sep 2002 09:21:02 +0100


| No yelling, but some random points for consideration:
|=20
| 1. It might be worth being more explicit, i.e. stating whether this is
| because the runtime explicitly enables echoing, or because it's
| assumed that echoing will already be enabled.

Well, at Haskell user doesn't care.  It's precisely because we want to
specify the behaviour of Haskell programs, regardless of the underlying
OS, that it's worth trying to nail down these things.  If the Haskell
RTS has to nudge the OS into echoing, that's what it should do.  This
only applies the default settings.  (You can change echoing settings via
the IO.hSetEcho etc.)

| 2. Is there actually anything special about the treatment of stdin, or
| does this apply to any input stream which is associated with a
| terminal?

I'm proposing just stdin.  My motivation is to make simple stupid
programs work right.  If people open other terminal devices they are
much more likely to know what they are doing.  It would be reasonable to
pin down what happens in that case, but I'm desperately afraid of
opening Pandora's box when I have to deliver the final bits to CUP in a
couple of weeks.  So, stdin only for now.=20

| 3. In general, "magic" behaviour (e.g. clearing the ICANON flag when
| disabling buffering) should at least be documented, otherwise it's
| likely to confuse experienced programmers.=20

Well I have never heard of the ICANON flag!  I don't expect to put it in
the Haskell report unless someone tells me it's absolutely unavoidable!

Simon