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,cae92f92d6a1d4b1 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news.mv.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada.Execution_Time Date: Tue, 14 Dec 2010 10:42:40 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <4d05e737$0$6980$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1292341361 20750 192.74.137.71 (14 Dec 2010 15:42:41 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 14 Dec 2010 15:42:41 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:M/6Io5Oz1RfRF2Ohk89DfU8RaaI= Xref: g2news1.google.com comp.lang.ada:15930 Date: 2010-12-14T10:42:40-05:00 List-Id: Jeffrey Carter writes: > The logic I recall from watching videos of Ichbiah, Barnes, and Firth > presenting Ada (80) at the Ada Launch was that a null statement > indicates that the sequence of statements (SOS) was intentionally null; > it was contrasted to the single semicolon used for the null statement in > some other languages, which is easily missed when reading, easily > accidentally deleted when editing, and generally considered a Bad > Thing. It's kind of a "belt and suspenders" solution. In C, you can say: for () ; and it's indeed easy to miss the empty statement, especially if the ";" is on the same line as the "for", and/or the following code is mis-indented. Ada solves this two ways -- you have to write "end loop;" and you also have to write "null;". The "end loop;" already solves the problem. Similar issue with dangling "else" -- Ada doesn't have them because of "end if". (Amazingly, in 2010, people continue to design programming languages with the dangling "else" problem. No excuse for it!) > As such, a pragma might be "something" and as such not require a null > statement, but I would disagree about a label. A label by itself would > make me wonder what happened to the statement it labels. Conceptually, a label does not label a statement -- it labels a place in the code. The Ada syntax rules are confused in this regard. I mean, when you say "goto L;" you don't mean to execute the statement labeled <> (and then come back here), you mean to jump to the place marked <>, and continue on from there. So if you want to jump to the end of a statement list, e.g. ...loop ... if ... then ... goto Continue; end if; ... <> end loop; it's just noise to put "null;" after <>. It's no big deal, of course, since gotos are rare. > Given the argument that the null statement is needed when there is no > other SOS, that SOS refers to executable statements, and that neither a > pragma nor a label are considered such,... Well, a pragma Assert is a lot like a statement. I find it really annoying to have to write "null;" before or after some Asserts. Pure noise, IMHO. (Again, no big deal.) >... I would guess this is contrary > to the intention of the original language designers. Almost everything that changed in Ada 95, 2005, and 2012 is contrary to the original intent. Indeed, during the Ada 9X project, Jean Ichbiah was quite angry that we were scribbling graffiti all over his near-perfect work of art. So be it. > I so like the idea that something explicit is required when a region > deliberately contains nothing that I'd like to see "null;" as a > declaration that is required when a declarative region contains nothing > else. I know. I've seen your code with "-- null;" in empty declarative parts. I'm sure you realize that in this case, yours is a minority opinion. It's another belt and suspenders thing. If you forgot to declare anything in the declarative part, you'll likely get errors when you refer to those missing declarations. Unless, of course, you forgot the code as well. When we see: procedure P is begin null; end P; how do we know the programmer didn't REALLY mean: procedure P is Message: constant String := "Hello, world."; begin Put_Line (Message); end P; ? Should we write: procedure P is Message: constant String := "Hello, world."; begin Put_Line (Message); null; end P; to indicate that we really did NOT want to do anything after the Put_Line? ;-) - Bob