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!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!xmission!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Elaboration order handling (Was: Bug in 'gnatmake') Date: Fri, 21 Jun 2013 15:10:04 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <7f33982d-3bcf-452e-a3b3-3a0a28505ff1@x20g2000vbe.googlegroups.com> <87r4g0g9c0.fsf@adaheads.sparre-andersen.dk> <87ip1bg4z2.fsf_-_@adaheads.sparre-andersen.dk> <53d0b070-a03b-43d0-a560-68dd3a8bebf5@googlegroups.com> <51c218df$0$6623$9b4e6d93@newsspool2.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 1371841805 30638 192.74.137.71 (21 Jun 2013 19:10:05 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 21 Jun 2013 19:10:05 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:lRb4VVWnao793s+Zl6pcLkNErmg= Xref: news.eternal-september.org comp.lang.ada:15880 Date: 2013-06-21T15:10:04-04:00 List-Id: Jeffrey Carter writes: > (By "statement", I mean something with a terminator semicolon that I > count as a statement when counting statements, which includes > declarations. By "null statement" I mean a statement identical to Ada's > null statement, even if it's a declaration. So, yes, the language could > require a null statement in a declarative part.) Interesting. You are very close to agreeing with me that statements and declarations are more-or-less the same thing (syntactically), and wherever one is allowed, so should the other. What's wrong with statements in a package spec (or body decl part)? If you allow "null;" in a declarative part, then why not allow an assignment statement, or a procedure call? And if you do that, there's no point at all to the "begin" that appears in the middle of a procedure body. Once in a while, I want to initialize an object using statements, because the "X: T := ...;" syntax doesn't work for some reason. package body P is X : ...; package Dummy is end; package body Dummy is begin for I in ... loop X(I) := ...; end loop; end Dummy; ... -- 1000 more lines of code That extra Dummy package doesn't aid readability. The other choice, moving the initialization way down into the "begin...end P;" part is also bad, because the initialization is far away from the declaration, and there's lots of opportunity to use uninitialized variables in between. - Bob