From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucbvax!COMMUNITY-CHEST.MITRE.ORG!howell From: howell@COMMUNITY-CHEST.MITRE.ORG Newsgroups: comp.lang.ada Subject: Exceptions Message-ID: <8906232157.AA07805@boardwalk.mitre.org> Date: 23 Jun 89 21:57:16 GMT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: I while back, I posted the following request to the net; attached are the replies I recieved. Thanks to those that replied! I'm hoping that this posting might stimulate more discussion on exception-handling issues (e.g., CLU and "Exceptional C"s language support for denoting potential exceptions from a unit, or paramterized exceptions...). Thanks again, Chuck Howell MITRE, Mail Stop Z-645 7525 Colshire Drive McLean, VA 22102-3481 howell@community-chest.mitre.org -------- From: mcvax!ukc!dcl-cs!aber-cs!pcg@uunet.uu.net (Piercarlo Grandi) Subject: Exception handling models 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 ---------------------------------------------------------- Return-Path: Date: Mon, 12 Jun 89 12:23:23 bst From: Tom Thomson To: howell%starbase.mitre.org@NSFNET-RELAY.AC.UK Subject: Exception Handling Models Two aspects that I care about:- i) have to have containment, so that I can correct the error locally (inside abstraction where it is detected) and avoid passing the exception to my user; but have to be able to pass exceptions on where appropriate. ii) separate the tasks of providing diagnostic information (eg trend information for preventative maintenance/component replacement) from those concerned with containment and recovery (eg correcting a single bit failure in a store with hamming codes, as opposed to logging the occurrence); the latter can do without being cluttered up with the former, and the former may need to be switchable independently of the latter. At a slightly more aspect level of modelling, I believe strongly in in-line exception handling. However this requires a language with a really good type system (so that the values arising from exceptions can be typed) with much type checking at run time, including the ability for code to discriminate on the type of the data it's operating on. There was some work on this in the Alvey Flagship project - - ICL & IC put exception values into the functional language HOPE+ but it was never really taken very far or exploited much. ----------------------------------------------------------- Return-Path: Date: Sun, 7 May 89 19:39:17 EDT From: emery@aries.mitre.org (David Emery) To: howell@starbase.mitre.org Subject: Re: exception models Cc: emery@aries.mitre.org i've often wished for exceptions with parameters (and exceptions AS parameters, but that's another story)). The basic model would probably not 'hurt' the language, but would trash implementations. here's some syntax ideas: raise an_exception(param => value); when an_exception => if an_exception.param = value then ... declaration syntax is a bit messier... an_exception : exception (param : its_type); dave -------------------------------------------------------------------