caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Line buffering
@ 2004-12-07 13:57 Richard Jones
  2004-12-07 18:10 ` [Caml-list] " Bruno.Verlyck
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Jones @ 2004-12-07 13:57 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 372 bytes --]


Is there a way to set line buffering, particularly of stdout?

Rich.

-- 
Richard Jones.  http://www.annexia.org/  http://www.j-london.com/
>>>   http://www.team-notepad.com/ - collaboration tools for teams   <<<
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
http://subjectlink.com/ - Lesson plans and source material for teachers

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Line buffering
  2004-12-07 13:57 Line buffering Richard Jones
@ 2004-12-07 18:10 ` Bruno.Verlyck
  2004-12-07 18:17   ` Richard Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Bruno.Verlyck @ 2004-12-07 18:10 UTC (permalink / raw)
  To: rich; +Cc: caml-list

   Date: Tue, 7 Dec 2004 13:57:45 +0000
   From: Richard Jones <rich@annexia.org>

   Is there a way to set line buffering, particularly of stdout?
Short answer: no.

The OCaml I/O system doesn't use C's FILE *.  It's (much) simpler,
efficient, and just not done with line buffering as a goal.  I looked
at it (io.c) while implementing Cash (line buffering is in the
original specification), and adding this would have made a too big
patch.  I gave up.

Bruno.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Line buffering
  2004-12-07 18:10 ` [Caml-list] " Bruno.Verlyck
@ 2004-12-07 18:17   ` Richard Jones
  2004-12-07 18:38     ` Nicolas Cannasse
  2004-12-08 16:15     ` Xavier Leroy
  0 siblings, 2 replies; 5+ messages in thread
From: Richard Jones @ 2004-12-07 18:17 UTC (permalink / raw)
  Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

On Tue, Dec 07, 2004 at 07:10:00PM +0100, Bruno.Verlyck@inria.fr wrote:
>    Date: Tue, 7 Dec 2004 13:57:45 +0000
>    From: Richard Jones <rich@annexia.org>
> 
>    Is there a way to set line buffering, particularly of stdout?
> Short answer: no.
> 
> The OCaml I/O system doesn't use C's FILE *.  It's (much) simpler,
> efficient, and just not done with line buffering as a goal.  I looked
> at it (io.c) while implementing Cash (line buffering is in the
> original specification), and adding this would have made a too big
> patch.  I gave up.

I noticed before that OCaml seems to implement its own I/O buffering
system, instead of using FILE* (or sfio, I guess).  Is there a reason
for that?

Thanks for the info anyway.  It's somewhat annoying that stdout can't
be line buffered.

Rich.

-- 
Richard Jones.  http://www.annexia.org/  http://www.j-london.com/
>>>   http://www.team-notepad.com/ - collaboration tools for teams   <<<
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
Learn Objective CAML - http://www.merjis.com/developers

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Line buffering
  2004-12-07 18:17   ` Richard Jones
@ 2004-12-07 18:38     ` Nicolas Cannasse
  2004-12-08 16:15     ` Xavier Leroy
  1 sibling, 0 replies; 5+ messages in thread
From: Nicolas Cannasse @ 2004-12-07 18:38 UTC (permalink / raw)
  To: Richard Jones, caml-list

> Thanks for the info anyway.  It's somewhat annoying that stdout
> can't be line buffered.

If you wrap the stdout with an ExtLib IO filter, you can buffer it how you
like.
But it will require changing your calls to printf by IO.printf for example.

Nicolas


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Line buffering
  2004-12-07 18:17   ` Richard Jones
  2004-12-07 18:38     ` Nicolas Cannasse
@ 2004-12-08 16:15     ` Xavier Leroy
  1 sibling, 0 replies; 5+ messages in thread
From: Xavier Leroy @ 2004-12-08 16:15 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

> I noticed before that OCaml seems to implement its own I/O buffering
> system, instead of using FILE* (or sfio, I guess).  Is there a reason
> for that?

Largely historical.  Early versions of Caml Light, circa 1990, had a
GC which did not play nice with "malloc", hence many standard C
library functions such as fopen() could not be used.  The buffering
code that I wrote at that time managed to survive until now.  

Also, bytecode-level threads (vmthreads) need to do non-blocking I/O
on I/O channels, and I don't think this could be done reliably with FILE*.
This said, one could also argue that bytecode-level threads are
another survivance of the past.

- Xavier Leroy


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-12-08 16:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-07 13:57 Line buffering Richard Jones
2004-12-07 18:10 ` [Caml-list] " Bruno.Verlyck
2004-12-07 18:17   ` Richard Jones
2004-12-07 18:38     ` Nicolas Cannasse
2004-12-08 16:15     ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).