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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: kevin.cline@gmail.com (Kevin Cline) Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: 24 Sep 2004 09:28:56 -0700 Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 198.23.5.11 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1096043336 346 127.0.0.1 (24 Sep 2004 16:28:56 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 24 Sep 2004 16:28:56 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:4114 Date: 2004-09-24T09:28:56-07:00 List-Id: Georg Bauhaus wrote in message news:... > Kevin Cline wrote: > : Are you really claiming that you can think of: > : > : procedure Insert (Word : in String) is > : > : procedure Increment_Count > : (K : in String; > : N : in out Natural) is > : > : pragma Warnings (Off, K); > : begin > : N := N + 1; > : end Increment_Count; > : > : C : Wordcount_Maps.Cursor; > : B : Boolean; > : > : begin -- Insert > : Insert (M, Word, 0, C, B); > : Update_Element (C, Increment_Count'Access); > : end Insert; > : > : As quickly as I can think of: > : ++concordance[word] > : or > : ++$count{$word} ? > > Isn't the comparison at different levels? AI 302 is to be minimal, I think, > in that every convenient operation can be built from thingies present in > Ada.Containers. > > > : Multiply this 1000 times for a medium to large program and I think Ada > : really suffer from unnecessary verbosity. > > Are you saying that Ada programmers automatically don't make reusable > procudures and instead will repeat a procedure with the effect of ++ all > over the place? The insert procedure is not reusable. It is specific to Wordcount_Maps. To be reusable it would have to be made generic, and then it would have to be instantiated before it could be used. In C++ you can write ++concordance[word] because of two features present in C++ that are missing in Ada. C++ allows the indexing operator [] to be overridden, so that concordance[key] can be assigned a meaning. Also, C++ has reference types, so that concordance[key] can return a modifiable reference to the value, which can be incremented. Together, these functions allow user-defined types in C++ to be as convenient to use as the built-in array type. I think I made a fair comparison. A claim was made that Ada/CHARLES was essentially equivalent to the C++ STL. I took an example program written by the author of Ada/CHARLES and rewrote it in C++ and Perl. The C++ code was less than half as long, and the Perl code one-tenth as long.