[m-rev.] io.m latest full diff

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Jan 22 12:21:16 AEDT 2004


On 22-Jan-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> Fergus Henderson, Thursday, 22 January 2004:
> > On 22-Jan-2004, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> > > > 	% io__make_temp(Name, IO0, IO) creates an empty file
> > > > 	% whose name which is different to the name of any existing file.
> > > > [...]
> > > 
> > > I'm slightly worried about the interface to this predicate: can't the
> > > operation fail?  Or do we worry about that when we try to open it?
> > 
> > Yes, the operation can fail, but only in exceptional circumstances
> > (e.g. disk full), and in such cases, we throw an exception.
> 
> I thought the IO library reported errors via error codes?  Personally,
> I'd rather have just one idiom for this sort of thing.

Operations which can be expected to fail under unexceptional circumstances
(e.g. eof) return discriminated unions.  This includes opening files
and reading from an already-opened file. Operations which only fail
in exceptional circumstances, such as creating temporary files or
writing to an already-opened file, signal errors by throwing an
exception.

-- 
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-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list