[m-rev.] partial results from stream.get

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Apr 20 16:22:59 AEST 2007



On Fri, 20 Apr 2007, Peter Wang wrote:

> What's the best way to return partial results if an error occurs during
> stream.get?  Without changing stream.m, the only way seems to be to
> store a partial result in the Error value and provide a function to
> extract the partial result out of the Error.  However, this seems
> unsatisfactory.
>
> Maybe stream.result/1 should be changed to have a partial result
> alternative.  However, this would break existing switches.
>
>    :- type stream.result(T, Error)
> 	--->    ok(T)
> 	;       eof
> 	;       error(Error)
> 	;	error(T, Error).
>
> Are there better alternatives?

Ian, PeterW and I have discussed this in person.  Our conclusion was that
partial results are still a type of error so they should be handled by the
error type.  Also since an error type needed to handle partial results may
vary depending upon the unit being read the current definition the current
relationship between the input and reader classes, and the error type is
wrong.  The error type should be a parameter of the reader class but not
the input class.

I'll post a diff shortly that makes that change.

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