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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,699cc914522aa7c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1) Gecko/20060130 SeaMonkey/1.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Structured exception information References: <1168885771.30643.20.camel@localhost> <1168891576.30643.39.camel@localhost> <5NKdnTv2UZfVZTbYnZ2dnUVZ_vipnZ2d@megapath.net> <38z8yk9z1uxn$.1r6qpevwu2i7c.dlg@40tude.net> In-Reply-To: <38z8yk9z1uxn$.1r6qpevwu2i7c.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1168969846 12.201.97.213 (Tue, 16 Jan 2007 17:50:46 GMT) NNTP-Posting-Date: Tue, 16 Jan 2007 17:50:46 GMT Organization: AT&T ASP.att.net Date: Tue, 16 Jan 2007 17:50:46 GMT Xref: g2news2.google.com comp.lang.ada:8189 Date: 2007-01-16T17:50:46+00:00 List-Id: Dmitry A. Kazakov wrote: > > procedure Foo raises Foo_Error; -- Compile error! Generally, subprograms should raise exceptions because of precondition violations. If the preconditions are met, the subprogram should not raise an exception (barring things that are beyond the developer's control, such as running out of memory). So it would be better to associate a subprogram with a list of preconditions with the exception raised if each is violated: function Arccoth (Coth : Real) return Real when abs Coth < 1.0 raise Invalid_Coth; procedure Time_Limited (X : in Integer) when X = 0 raise Zero_X and when Ada.Calendar.Clock >= Ada.Calendar.Time_Of (Year => 2010, Month => 1, Day => 1, Seconds => 0.0) raise Too_Late;