Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!ames!lll-winken!uunet!mcvax!ukc!dcl-cs!aber-cs!pcg From: pcg@aber-cs.UUCP (Piercarlo Grandi) Newsgroups: comp.lang.ada Subject: Re: Exception handling models Summary: Exceptions don't exist. Dynamic scoping... Message-ID: <925@aber-cs.UUCP> Date: 9 May 89 16:05:57 GMT Reply-To: pcg@cs.aber.ac.uk (Piercarlo Grandi) Distribution: eunet,world Organization: Dept of CS, UCW Aberystwyth (Disclaimer: my statements are purely personal) Lines: 32 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