NICE-ESG-Libs Digest Tue, 28 Nov 95 Volume 1 : Issue 309
Today's Topics:
Exceptions
NICE Eiffel Standards Group -- Library Committee Mailing List
To post to list:
NICE-ESG-Libs@atlanta.twr.com
To send mail to the Chairman of the committee:
NICE-ESG-Libs-chair@atlanta.twr.com
Administrative matters (sign up, unsubscribe, mail problems, etc):
NICE-ESG-Libs-request@atlanta.twr.com
Date: Mon, 27 Nov 1995 21:05:25 GMT
From: Roger Browne
Subject: Exceptions
To: NICE-ESG-Libs@atlanta.twr.com
In Digest #308 Paul Johnson wrote:
> ... A class of unique
> integers would be far better: after all the most common thing for the handler
> to do is a discrimination on the type of the exception...
If we want to discriminate on the type of the exception, surely the
type mechanism is the appropriate way to do it?
> For example a comms package might generate an exception when a link
> goes down.
With a class-based exception mechanism it might work like this:
at the innermost level the LINK_GONE_DOWN exception might cause a wait then
a retry, before falling through to the next layer of exception handling
which catches the COMMS_ERROR exception (of which LINK_GONE_DOWN is a
descendant) and attempts to re-establish a suitable alternative circuit,
before falling through to the next layer of exception handling which
catches the IO_ERROR exception (of which COMMS_ERROR is a descendant)
and causes the current database transaction to be rolled back.
With a flat integer-numbered exception space we end up with lots of
inspect statements with long lists of unique integer constants. The one that
rolls back the database transaction on IO Errors must enumerate every
unique intieger that represents an IO Error kind of exception. Then,
as soon as a new kind of IO Error exception is added elsewhere in the
system, we have an bug whereby the database is not rolled
back when that new kind of exception is triggered.
That class of bugs can so easily be engineered out of Eiffel systems by
adopting a heirarchical, class-based tree of EXCEPTION types.
Regards,
Roger
--
-- Roger Browne, 6 Bambers Walk, Wesham, PR4 3DG, UK | Ph 01772-687525
-- Everything Eiffel: compilers/libraries/publications | +44-1772-687525

|
|