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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f66d11aeda114c52 X-Google-Attributes: gid103376,public X-Google-Thread: fac41,f66d11aeda114c52 X-Google-Attributes: gidfac41,public From: jsa@alexandria.organon.com (Jon S Anthony) Subject: Re: Building blocks (Was: Design By Contract) Date: 1997/09/19 Message-ID: #1/1 X-Deja-AN: 273911492 Distribution: world References: <5v34m5$pl9$1@trumpet.uni-mannheim.de> <34215E3D.77AE@gsfc.nasa.gov> <3421E190.49CC@chimu.com> Organization: PSINet Newsgroups: comp.lang.ada,comp.lang.eiffel Date: 1997-09-19T00:00:00+00:00 List-Id: In article <3421E190.49CC@chimu.com> "Mark L. Fussell" writes: > is > -- The Eiffel version of the above > local > attempts : INTEGER -- FYI: initializes attempts to 0 > do > if attempts = 0 then > -- do main stuff > else > -- do nothing > end > rescue > attempts := attempts + 1 > retry > end > Most of the difference between the Eiffel and Ada approach is really > "what it feels like" in the exception handler. That sounds "right" to me. > Eiffel's exception handler give you a chance to retry the main body > which can than do what ever it wants (within its contract), but in > so doing returns you to thinking about how to satisfy the routine > call. The Ada (and many other languages) approach allows you to try > to both recover from the exception and satisfy the routine call in > one place. This may lead you to forget to do one or both of these > responsibilities. Is the Eiffel approach really conceptually different from a recursive "retry" (where the Eiffel retry is basically a structured goto the beginning of the current invocation)? For example, procedure P (.... Attempts : Natural := 0) is ... if Attempts = 0 then -- do main stuff else -- do nothing end; exception when others => -- (or more specific exception...) P(....Attempts+1) ... end P; /Jon -- Jon Anthony STL, Belmont, MA 02178, 617.484.3383 "Nightmares - Ha! The way my life's been going lately, Who'd notice?" -- Londo Mollari