[Haskell-cafe] Fwd: Default stdout buffering of child processof createProcess

Elliot Robinson elliot.robinson at argiopetech.com
Sun Aug 3 20:05:38 UTC 2014


On Sun, Aug 3, 2014 at 3:08 PM, Brandon Allbery <allbery.b at gmail.com> wrote:

> On Sun, Aug 3, 2014 at 2:43 PM, Elliot Robinson <
> elliot.robinson at argiopetech.com> wrote:
>
>> On Sat, Aug 2, 2014 at 3:54 AM, Donn Cave <donn at avvanta.com> wrote:
>>
>>> Handles are for buffered I/O.
>>
>>
>> If this is the case, why is NoBuffering provided? Why does the
>> documentation for Handle explicitly mention non-existent and zero-length
>> buffers? If Handles are the standard cross-platform interface to buffered
>> file IO, what is the standard cross-platform interface to unbuffered IO
>> (output, specifically, since input is technically always at least 1 byte
>> buffered)?
>>
>
> Handles provide a non-buffered interface, but often if you truly need
> unbuffered I/O you will be better suited by the platform's primitive
> operations; for which abstractions that enable some kind of reasonably
> platform independent interface may well cancel out the advantages of
> unbuffered I/O for those cases.
>

As a platform-specific optimization, this makes total sense. Most of the
people who need this optimization know they need it. My fear is that
offering "handles are for buffered I/O" (and statements like it) as general
case rules leads to the "I'm new to <field> and I'm using System.Posix.IO
for unbuffered IO because Handles aren't good for that, and now my program
doesn't compile on <non-Posix OS>" ilk of Haskell-Cafe/SO questions.

---
Elliot Robinson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140803/2e11de34/attachment.html>


More information about the Haskell-Cafe mailing list