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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Tests in a software release Date: Wed, 15 Nov 2017 15:53:41 -0600 Organization: JSA Research & Innovation Message-ID: References: Injection-Date: Wed, 15 Nov 2017 21:53:42 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="16310"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: feeder.eternal-september.org comp.lang.ada:48915 Date: 2017-11-15T15:53:41-06:00 List-Id: "Dmitry A. Kazakov" wrote in message news:ouguv4$1h92$1@gioia.aioe.org... > On 15/11/2017 01:06, Randy Brukardt wrote: > >> I'd consider making an argument for a pragma to *require* an ELSE part >> for >> all IF statements. > > Only if return and raise statements had the forms: > > return Result when Condition; > > raise Exception with Text when Condition; You're right that sometimes the comment isn't very enlightening: if Condition then return Result; -- else nothing needed. end if; ...but note that often in such cases it is useful to say how the result will be determined if Condition is False: -- else continue looking for the result. which does provide useful information to a reader (especially one that hasn't looked at a particular subprogram in a decade, something that happens a lot when debugging a long-lived program like Janus/Ada). The place where this comment is annoying is for tracing: if J2Trace.Trace(This_Unit) then Put_Line ("Type " & Type_Ptr'Image(The_Type) & " is unconstrained"); -- else no trace needed. end if; Here, the else comment is noise. I personally usually leave it out (having an exception in the style guide for trace messages), but others (especially Isaac) always followed the rule religiously, so Janus/Ada is full of this comment. Randy.