Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!eru!hagbard!sunic!news.funet.fi!tukki.jyu.fi!sakkinen From: sakkinen@tukki.jyu.fi (Markku Sakkinen) Newsgroups: comp.lang.eiffel Subject: Re: Exceptions and Assertions Keywords: eiffel exceptions assertions preconditions Message-ID: <1990Sep10.073627.17213@tukki.jyu.fi> Date: 10 Sep 90 07:36:27 GMT References: <1990Sep7.032121.6456@bony1.uucp> <14831@yunexus.YorkU.CA> Reply-To: sakkinen@jytko.jyu.fi (Markku Sakkinen) Organization: University of Jyvaskyla, Finland Lines: 47 In article <14831@yunexus.YorkU.CA> davecb@yunexus.YorkU.CA (David Collier-Brown) writes: >Speaking of exceptions, Rick Jones writes: >| One of Eiffel's most powerful features is its exception handling, and in my >| current work I am experimenting with a programming style which places heavy >| reliance on this system. The general concept is that _all_ "non-normal" >| conditions are treated as exceptions, including those which may be expected to >| occur quite frequently. > >richieb@bony1.uucp (Richard Bielak) writes: >| IMHO, pushing non-normal cases into exception handlers is wrong. An >| exception should only be used to handle the cases that were not >| foreseen by the developer. Doing a "raise" and handling a condition >| elsewhere in the program has two problems: >| ... > > We're really seeing a continuum here: the normal case, the general case >and the exceptional case. > ... > > Exception-handlers are suitable for exceptions, but probably not >for the general-case, predictable boundary/oddball conditions. We >need a notation for the latter... It seems to be in line with Bertrand Meyer's and Eiffel's attitudes that exceptions are reserved for truly exceptional cases. Probably there is no language that explicitly supports the kind of three-case distinction that David Collier-Brown suggests. Of course, language features can often be used in such ways or for such purposes that the language's designers either have not imagined or disapprove. My favourite example is Lynn Andrea Stein's OOPSLA'87 paper, "Delegation Is Inheritance", where she showed that Smalltalk-80 classes can be used as unique objects to provide the same kind of delegation that is typical in classless OOPL's. The extreme opposite to Eiffel w.r.t. exceptions is Modula-3, in which exceptions are employed not only in "general" but also in "normal" cases: an EXIT from a loop and a RETURN from a procedure cause exceptions. Markku Sakkinen Department of Computer Science University of Jyvaskyla (a's with umlauts) Seminaarinkatu 15 SF-40100 Jyvaskyla (umlauts again) Finland SAKKINEN@FINJYU.bitnet (alternative network address)