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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,7d3cb5920e882220 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!i3g2000hsf.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Exceptions Date: Wed, 12 Dec 2007 14:10:25 -0800 (PST) Organization: http://groups.google.com Message-ID: <4dae26fe-0c8a-46e1-9a33-43c18cf757ae@i3g2000hsf.googlegroups.com> References: <5947aa62-2547-4fbb-bc46-1111b4a0dcc9@x69g2000hsx.googlegroups.com> <475c688f$0$17524$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Host: 85.3.66.120 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1197497426 20097 127.0.0.1 (12 Dec 2007 22:10:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 12 Dec 2007 22:10:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i3g2000hsf.googlegroups.com; posting-host=85.3.66.120; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.9) Gecko/20071025 Firefox/2.0.0.9,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:18914 Date: 2007-12-12T14:10:25-08:00 List-Id: On 11 Gru, 09:07, Stephen Leake wrote: > For code I have control over, I agree with Bob, except I use a > different exception; raise Programmer_Error if you've detected a bug. I understand that this way you want to signal something much more severe than "mere" Constraint_Error or such. The problem is that Program_Error can be shut up by some null handler or it can be translated to some other exception and then lose its original weight. Why not terminating the program right on the spot by simply: pragma Assert (False); ? (yes, there are compiler options to switch it off as well) Does anybody use this strategy in regular code? I happen to use it in test units and I find it very appropriate there. Any thoughts on using assertions, including Assert(False), in production code? -- Maciej Sobczak * www.msobczak.com * www.inspirel.com