[m-dev.] Minimal streams diff

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Oct 3 12:01:27 AEST 2002

On 03-Oct-2002, Michael Day <mikeday at yeslogic.com> wrote:
> > I think the stream module needs a little more thought, however.  There's
> > no way of handling such things as bulk IO and it only handles char
> > streams.  There are other issues such as buffering and blocking and so
> > forth to consider, as well.
> If by bulk IO you mean writing out an array of characters at a time, that
> can happen below the stream interface, in its implementation. The stream
> implementations I am using buffer characters until the buffer is full (or
> flush_output is called) and then write them all out at once, and the input
> stream implementation performs read ahead. Does that need to be in the
> interface, though?

At very least flush_output needs to be part of the class interface for
output streams.  I'm not sure what is needed for input streams.

It would also be useful to provide unbuffered streams,
and to support bulk IO for them.

> > (Admittedly, generalising away from char will probably require
> > a more powerful type class scheme.)
> s/probably/definitely/ :)

Yes, that change should wait until the type system is more powerful.

Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au

More information about the developers mailing list