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,81bb2ce65a3240c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.205.122.65 with SMTP id gf1mr6745bkc.2.1335568723976; Fri, 27 Apr 2012 16:18:43 -0700 (PDT) MIME-Version: 1.0 Path: h15ni173139bkw.0!nntp.google.com!news1.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.ecp.fr!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: What would you like in Ada202X? Date: Fri, 27 Apr 2012 18:18:34 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <3637793.35.1335340026327.JavaMail.geo-discussion-forums@ynfi5> <13849842.838.1335485882969.JavaMail.geo-discussion-forums@vbai3> <134641.307.1335542673651.JavaMail.geo-discussion-forums@pbrx5> <2867357.127.1335561067669.JavaMail.geo-discussion-forums@ynee1> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1335568722 15269 69.95.181.76 (27 Apr 2012 23:18:42 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 27 Apr 2012 23:18:42 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2012-04-27T18:18:34-05:00 List-Id: wrote in message news:2867357.127.1335561067669.JavaMail.geo-discussion-forums@ynee1... >procedure Shut_Down_Reactor (Reactor : Reactor_Type) is null; > >is quite literally a disater waiting to happen. Sure, but bad management is not a reason to not include a language feature that is useful. > Ada is all about being explicit, And this *is* explicit. It says "is null", it doesn't imagine that. >and takes a harsh stance on things that could be misused or abused to make >a program confusing (i.e. overloading, >etc), yet it gives an express lane >for writing subprograms that by definition don't do what they intend. This is a significant misreading of Ada's design. Ada 83 included operator overloading, even though it is EASY to abuse that to write a confusing program: function "*" (Left, Right : My_Type) return My_Type is begin return Left + Right; end "*"; The Ada 83 Rationale has an explicit statement about this; the feature was included because it was useful, even though it can be misused. And there are many other features (new and old) that can be abused. We've talked about this several times in the ARG, and our feeling is that it is not our job (or the language's job) to prevent intentional misuse of the language. What Ada strives for is eliminating *unintentional* misuse; it hard to see that in this case (this is clearly intentional). There is no replacement for sensible and enforced programming style (and management that understands that without being heavy-handed). Null procedures are intended to be used in places where doing nothing is a reasonable default action. For instance, when you have a "hook" that you wouldn't always use. One example was the (eventually rejected) storage pool dereference procedure; most pools would have no use for it, so it could be a null procedure; pools that did have a use for it could replace it with something interesting. Note that Ada 95 did that (implicitly) for the Initialize/Adjust/Finalize routines of type Controlled. We made that more explicit in Ada 2005, but that did not reflect any language change. This is another example of a "hook". Using a null procedure for something that must have an action is a serious bug, one that could not fail to be caught by a code review (it's hard to miss the very explicit "is null" in the code). > The phrase "where the default behavior is null" is a contridiction in > terms; calling > a subprogram to achieve the effect of not calling a subprogram is simply > bananas. As noted above, it's common to have "hook" routines that aren't used in most implementations. It's impossible in general to remove those calls, so what else would you have the subprogram do?? Randy.