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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,79bbf7e359159d0d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-05 04:10:06 PST Path: supernews.google.com!sn-xit-03!supernews.com!nntp.cs.ubc.ca!newsfeed.direct.ca!look.ca!newsfeed.icl.net!newspeer.clara.net!news.clara.net!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!not-for-mail Message-ID: <3ACC5053.10D0BC7E@ntlworld.com> From: "martin.m.dowie" Reply-To: martin.m.dowie@ntlworld.com X-Mailer: Mozilla 4.76 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: newbie can't get exceptions to work! References: <3ACBE436.4B247767@nmt.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 05 Apr 2001 12:00:35 +0100 NNTP-Posting-Host: 213.104.131.53 X-Complaints-To: abuse@ntlworld.com X-Trace: news2-win.server.ntlworld.com 986468647 213.104.131.53 (Thu, 05 Apr 2001 12:04:07 BST) NNTP-Posting-Date: Thu, 05 Apr 2001 12:04:07 BST Organization: ntlworld News Service Xref: supernews.google.com comp.lang.ada:6501 Date: 2001-04-05T12:00:35+01:00 List-Id: or do what the language does viz-a-viz Ada.Text_IO and create a separate package to declare the exceptions and then raise them from within the generic body definitions. This way all instances use the same exception. I'll leave it to you to decide if this is a 'good thing' ;-) e.g. package Stack_Exceptions is Usage_Error : exception; Overflow_Error : exception; end Stack Exceptions; with Stack_Exceptions; package body GEN_STACK is -- stuff procedure PUSH (...) is begin -- raise Stack_Exceptions.Overflow_Error; -- end PUSH; -- end GEN_STACK; Ed Falis wrote: > Jeff Shipman wrote: > > Ok, I'm creating a generic stack package and I think > > I've done everything properly, but I cannot seem to > > get my STACK_EXCEPTION to work. This is what it > > looks like in my gen_stack.ads file: > > The following line in the error messages is the key: > > use_gen_stack.adb:214:12: multiple use clauses cause hiding > > Each instantiation of the stack package that you made created a > different exception Stack_Error. The compiler can't tell which one you > intend to handle. Either set up the exception handler with a choice > list using the fully qualified names: > > when Inst_1.Stack_Error | Inst_2.Stack_Error => -- etc, listing all of > them > > or just use a "when others => " choice. > > - Ed