* [Caml-list] Setting Pervasive's stderr to unbuffered as default?
@ 2015-08-23 0:19 Oliver Bandel
2015-08-24 12:19 ` Sébastien Hinderer
0 siblings, 1 reply; 5+ messages in thread
From: Oliver Bandel @ 2015-08-23 0:19 UTC (permalink / raw)
To: caml-list
Hello,
stderr on Unix is unbuffered by default.
In OCaml, all the Channels from Pervasives are buffered by default,
and flush-function must be used.
This issue is annoying me since ages...
Is there a way to set Unix-like-behaviour (unbuffered stderr =>
unbuffered Pervasives.stderr)
as default?
Something like setbuf(3) / setvbuf(3) for OCaml's pervasives?
Would a feature-wish for this feature have any chance of success?
Ciao,
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Setting Pervasive's stderr to unbuffered as default?
2015-08-23 0:19 [Caml-list] Setting Pervasive's stderr to unbuffered as default? Oliver Bandel
@ 2015-08-24 12:19 ` Sébastien Hinderer
2015-08-25 11:09 ` Gerd Stolpmann
0 siblings, 1 reply; 5+ messages in thread
From: Sébastien Hinderer @ 2015-08-24 12:19 UTC (permalink / raw)
To: caml-list
Hi,
Oliver Bandel (2015/08/23 02:19 +0200):
> Hello,
>
> stderr on Unix is unbuffered by default.
>
> In OCaml, all the Channels from Pervasives are buffered by default,
> and flush-function must be used.
> This issue is annoying me since ages...
[...]
I'd also prefer an unbuffered stderr, finding it more intuitive.
Thanks for havign mentionned that,
Sébastien.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Setting Pervasive's stderr to unbuffered as default?
2015-08-24 12:19 ` Sébastien Hinderer
@ 2015-08-25 11:09 ` Gerd Stolpmann
2015-08-25 11:52 ` Sébastien Hinderer
2015-08-25 12:32 ` Xavier Leroy
0 siblings, 2 replies; 5+ messages in thread
From: Gerd Stolpmann @ 2015-08-25 11:09 UTC (permalink / raw)
To: Sébastien Hinderer; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 1372 bytes --]
I cannot follow. Pervasives.stderr is unbuffered; however (see
pervasives.ml):
let print_endline s =
output_string stdout s; output_char stdout '\n'; flush stdout
let print_newline () = output_char stdout '\n'; flush stdout
let prerr_endline s =
output_string stderr s; output_char stderr '\n'; flush stderr
let prerr_newline () = output_char stderr '\n'; flush stderr
So far I know these are the only functions doing an implicit flush, and
they are doing it for both stdout and stderr.
Gerd
Am Montag, den 24.08.2015, 14:19 +0200 schrieb Sébastien Hinderer:
> Hi,
>
> Oliver Bandel (2015/08/23 02:19 +0200):
> > Hello,
> >
> > stderr on Unix is unbuffered by default.
> >
> > In OCaml, all the Channels from Pervasives are buffered by default,
> > and flush-function must be used.
> > This issue is annoying me since ages...
>
> [...]
>
> I'd also prefer an unbuffered stderr, finding it more intuitive.
>
> Thanks for havign mentionned that,
> Sébastien.
>
--
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de
My OCaml site: http://www.camlcity.org
Contact details: http://www.camlcity.org/contact.html
Company homepage: http://www.gerd-stolpmann.de
------------------------------------------------------------
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Setting Pervasive's stderr to unbuffered as default?
2015-08-25 11:09 ` Gerd Stolpmann
@ 2015-08-25 11:52 ` Sébastien Hinderer
2015-08-25 12:32 ` Xavier Leroy
1 sibling, 0 replies; 5+ messages in thread
From: Sébastien Hinderer @ 2015-08-25 11:52 UTC (permalink / raw)
To: caml-list
Hi,
Gerd Stolpmann (2015/08/25 13:09 +0200):
> I cannot follow. Pervasives.stderr is unbuffered;
How do you know, actually?
If it would be, then th flushes in the functions dealing with stderr
that you showed wold not be necessary,would they?
Thanks!
Sébastien.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Setting Pervasive's stderr to unbuffered as default?
2015-08-25 11:09 ` Gerd Stolpmann
2015-08-25 11:52 ` Sébastien Hinderer
@ 2015-08-25 12:32 ` Xavier Leroy
1 sibling, 0 replies; 5+ messages in thread
From: Xavier Leroy @ 2015-08-25 12:32 UTC (permalink / raw)
To: caml-list
On 25/08/2015 13:09, Gerd Stolpmann wrote:
> I cannot follow. Pervasives.stderr is unbuffered; however (see
> pervasives.ml):
Just to avoid possible misunderstandings:
- All Pervasives.out_channel are buffered. There is no such thing
as an unbuffered out_channel.
- A few "print" functions from Pervasive flush explicitly when
printing a newline (because those functions are often used for
interactive I/O).
- The "%!" modifier for printf also forces a flush.
Hope it's clearer now.
- Xavier Leroy
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-08-25 12:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-23 0:19 [Caml-list] Setting Pervasive's stderr to unbuffered as default? Oliver Bandel
2015-08-24 12:19 ` Sébastien Hinderer
2015-08-25 11:09 ` Gerd Stolpmann
2015-08-25 11:52 ` Sébastien Hinderer
2015-08-25 12:32 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox