[m-dev.] Minimal streams diff

Michael Day mikeday at yeslogic.com
Thu Oct 3 10:47:40 AEST 2002

> I like this idea.  We could make std{in,out,err} instances of stream
> classes in the io module and add type specialization pragmas if needed
> to ensure good performance therein.

How to make an instance of stream for stdin, when stdin is just a 
particular input_stream returned by stdin_stream?

> 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?

I use streams as if they are byte streams, as that's practically what they
are on unix at least.

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

s/probably/definitely/ :)


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