Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Line buffering
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-08 (16:16)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] Line buffering
> 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