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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Software landmines (was: Why C++ is successful) Date: 1998/08/24 Message-ID: <6rsg0d$pcj@dfw-ixnews3.ix.netcom.com>#1/1 X-Deja-AN: 384293518 References: <6rnhhe$e2u$1@nnrp1.dejanews.com> Organization: ICGNetcom X-NETCOM-Date: Mon Aug 24 2:47:25 PM CDT 1998 Newsgroups: comp.lang.ada Date: 1998-08-24T14:47:25-05:00 List-Id: In article <6rnhhe$e2u$1@nnrp1.dejanews.com>, dewar@gnat.com wrote: >... We didn't eliminate >assignments from Ada, even though they can be (and are all the time) >horribly misused, and even though we know perfectly well that you can >write programs with no assignments with no loss in expressive power. I cannot imagine writing a large program totally devoid of assignment statements. In fact, I sometimes see people programming around the assignment by parenthetical nesting of function returns and find it confusing, reminsicent of the German sentences of philosophers who, in an attempt to extract every nuance from an idea without leaving any possibility for misinterpretation, along with, what seems to be an attempt to avoid using an excessive number of periods in their sentences, construct long, dependent clause-filled sentences, the effect of which is to leave one, if, in fact, one is still reading, without any sense of what the original idea might have been from the beginning. Don't take away my assignment statements, Robert. The help me write crisp, short code sentences that ordinary mortals can understand. In fact, as an old time Fortranner, I sometimes write a function that looks like, function F ( ... ) return some-data-type is Result : some-data-type := initial-value; begin Result := algorithmic-part; return Result; end F; >... most programmers furiously overuse assignments, and it is >far too common to see a variable assignment used to establish a constant >value I am not sure what you mean. If I want to define constants, Zero : constant := 0; Null_List := some-value; how do I set the initial value without assignment. For private members in C++ this is really easy without assignment. I can use (must use) an initialization list. In Ada we have to have an assignment somewhere to make this happen. of course languages like traditional C which have no capability >for defining constants aggravate the problem!) But this is not true for C++ where one can use the initialization list as shown above and one can even define a function as a const, the parameters as const, etc. In this respect, C++ is a little more powerful (read, safer) than Ada especially when using pointers as parameters. For lots of other reasons, I still prefer Ada. Richard Riehle richard@adaworks.com www.adaworks.com