[comp.lang.ada] Exception handling models

howell@STARBASE.MITRE.ORG (Chuck Howell) (05/03/89)

I'm interested in alternative exception handling models (e.g., Bertrand
Myer's arguments on "disciplined exceptions" in _Object-oriented
Software Construction_) and various idioms & conventions for use with
existing Ada exception handling facilities.
Any comments (e.g., "If I don't get parameterized exceptions in Ada9X,
I'll hold my breath 'till I turn blue!"), references, or summaries of
related work will be appreciated;  I'll post a summary to the Net.

thanks,

	Chuck Howell
	MITRE, Mail Stop W418
	7525 Colshire Drive
	McLean, VA 22102-3481
	howell@starbase.mitre.org

pcg@aber-cs.UUCP (Piercarlo Grandi) (05/09/89)

In article <8905021917.AA06033@starbase> howell@STARBASE.MITRE.ORG (Chuck Howell) writes:
    I'm interested in alternative exception handling models (e.g., Bertrand
    Myer's arguments on "disciplined exceptions" in _Object-oriented
    Software Construction_) and various idioms & conventions for use with
    existing Ada exception handling facilities.

I have long held that exception handling does not exist; an exception is
always the result of a missing case in some part of a program, i.e. the
program not computing a total function wrt its input data domain.

Exception "handling" is just adding in the appropriate places calls to
procedures to define the missing cases; such procedures whould be
dynamically scoped, so that they can be redefined dynamically.

In other words: "raise" should be replaced by a call to a dynamically
scoped procedure; dynmically scoped procedures should be added to the
language (a trivial exercise).

The issue of non local control transfer, which in the present exception
handling facility is wrongly and inextricably tied to exception handling,
should be provided as an orthogonal mechanism, as not all exception
"handlers" want to terminate with a non local goto, and not all uses of non
local gotos are in exception handlers.

I have posted a few months ago in comp.lang.c++ a C++ class that implements,
using constructors and destructors, dynamically scoped procedures as
exception handlers. It cannot be done as easily in Ada, without changing
the language a bit.
-- 
Piercarlo "Peter" Grandi           | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcvax!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk