[mercury-users] Exceptions and unique modes
Ralph Becket
rbeck at microsoft.com
Wed Feb 21 23:37:55 AEDT 2001
>From Peter Ross on 21/02/2001 12:21:36
> >
> An interesting point was raised by Paul Massey here at MC, and that is a
> predicate should return either a status indicator or throw an exception
but
> never do both. So you could argue that the IO predicates should report
> EOF as an exception as well or return everything in the status
> indicator.
But, I claim, EOF is not an exceptional condition and hence should be a
valid result! An error is an exceptional condition.
Your example problem, as I understand it, can be paraphrased as
- carry out some operation, allocating resources along the way
- if something goes wrong, deallocate any resources that did
get allocated and clean up the structure of interest
You say that carrying an io__state around to do this is unacceptable, but
don't say why. Admittedly it might be inconvenient, but it *is* the place
where you need to put persistent state, such as the information required
by the recovery code.
--
Ralph Becket | MSR Cambridge | rbeck at microsoft.com
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list