[m-rev.] for review: stream typeclasses

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Oct 26 11:51:22 AEST 2006


On Mon, 23 Oct 2006, Peter Ross wrote:

>> +%-----------------------------------------------------------------------------%
>> +%
>> +% Input streams
>> +%
>> +
>> +    % An input stream is a source of data.
>> +    %
>> +:- typeclass stream.input(Stream, State, Error)
>> +    <= ( stream(Stream, State), stream.error(Error), (Stream -> Error) )
>> +    where
>> +[
>> +    % For buffered input streams this method causes the buffer
>> +    % to be filled.  For unbuffered streams it is a no-op.
>> +    %
>> +    pred fill(Stream::in, State::di, State::uo) is det
>> +].
>> +
> Why do you need a fill predicate?
>
> If streams are managing there own buffer, I can't see how it can be to
> the users benefit to request the buffer to be filled, unless the filling
> of the buffer is an asynchronous operation.
>
> If the stream doesn't manage it's own buffer, then shouldn't one
> have an is_input_buffer_empty predicate?
>
> Anyway more justification of this is needed for me.

I'll leave it out for now - adding it later, if it's needed, won't cause
too many problems.

Julien.

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list