[Haskell-cafe] Re: Coming up with a better API for
Colin Paul Adams
colin at colina.demon.co.uk
Fri Feb 27 04:25:25 EST 2009
> Anyway, the POSIX spec indicates the EOF condition as return -1 with errno
> == ECONNRESET; this should not be taken as anything but the limited
> expressiveness of a C-based API. We should map this return to Nothing.
Johan> I'm not sure I agree. I think using exceptions in this case is fine as
Johan> loosing the connection is indeed an exceptional condition and the best
Johan> thing a program can do in this case is probably to abort processing of
Johan> the disconnected client.
I guess this depends upon how exceptional you want an exception to be.
To my mind, a lost connection is a fairly normal condition (FAR to
normal for my teleworking situation :-( ). That is, I would expect
the exception to occur rather than not, during one run of a
program. On that basis, I would suggest Nothing is better than an
But I guess it depends upon the program. For long running servers,
my expectation above is surely true. But other "servers" might not
share the same expectation.
Perhaps it should be configurable?
More information about the Haskell-Cafe