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!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.ada Subject: Re: Why .ads as well as .adb? Date: Mon, 03 Jun 2019 12:49:05 -0700 Organization: None to speak of Message-ID: References: <28facad3-c55f-4ef2-8ef8-004925b7d1f1@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="2e0b7da47f6ad3e1490831b7250ade4a"; logging-data="7230"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+srLPqWEI++HEYJhnNGhdS" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:DLXzBaBV6k391k4iy6seJapn/SY= sha1:1AtYUscitZ6CvRruihmm7sUtYwE= Xref: reader01.eternal-september.org comp.lang.ada:56450 Date: 2019-06-03T12:49:05-07:00 List-Id: "J-P. Rosen" writes: [...] > I don't agree. Yes, Ada is more verbose, but it tells you clearly what > is a declaration, and what are executable statements. In C/C++ , there > is this "Oh, this is a statement, let's assume we have left the > declarations part" that I don't like. Granted, it's a matter of taste. There is no "declarations part". C++ allows declarations and statements to be mixed within a block. (C does too, since the 1999 standard.) Declarations and statements are syntactically distinct, so there's no ambiguity. void func() { int x; // declaration x = 42; // statement printf("x = %d\n", x); // statement int y = 43; // declaration printf("y = %d\n", y); // statement } That's inside a function definition. Outside a function definition, declarations are allowed and statements are not. And declarations can involve execution of code (as in Ada). Yes, it's a matter of taste, and I'm not arguing for one approach over the other. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */