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,deeb88b0e7eede4f X-Google-Attributes: gid103376,public From: jsa@organon.com (Jon S Anthony) Subject: Re: Help with Exceptions! Date: 1996/05/10 Message-ID: #1/1 X-Deja-AN: 154173289 sender: news@organon.com (news) references: <4mmimq$s4r@hatathli.csulb.edu> <318F353D.4531@mtm.syr.ge.com> organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-05-10T00:00:00+00:00 List-Id: In article <4mt0um$dgu@hearst.cac.psu.edu> RLS@psu.edu (Robert L. Spooner, AD3K) writes: > Another way to reexecute a statement is to have the function call > itself from the exception handler, after outputting an error > message. Once the user enters valid input, the function > willrecursively return with the proper value. For user input from a > keyboard, any performance differences between the loop and the > recursive function call will be negligible. This is a nice trick which allows you to approximate Eiffel style exception capabilities. > function Response (Prompt : String) return integer is > > line : ... > Size : ... > > begin > Put (Prompt); > Get_Line (...; > return ... > exception > when others => > Put_Line (...; -- error message > return Response(Prompt); > end Response; /Jon -- Jon Anthony Organon Motives, Inc. 1 Williston Road, Suite 4 Belmont, MA 02178 617.484.3383 jsa@organon.com