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,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada References: Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: Fri, 24 Sep 2004 16:14:48 -0400 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Message-ID: <41547dae$0$91007$39cecf19@news.twtelecom.net> Organization: Time-Warner Telecom NNTP-Posting-Date: 24 Sep 2004 20:03:58 GMT NNTP-Posting-Host: 061057f2.news.twtelecom.net X-Trace: DXC=VdoDh4b;>JZXl]78kQj6]hHXa^^g6TZT<4TLheeGkdQdYZAA8S: "Kevin Cline" wrote in message news:e749549b.0409240828.53001e66@posting.google.com... > > 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. Note that (as Randy alluded to) there's still a chance the ARG will add something like reference types to Ada. It would be declared something like: function Update_Element (Container : in Map; Key : in Key_Type) return access Element_Type; Then you could say: Update_Element (M, K).all := 42; In our wordcount example you'd have to say: declare N : Natural renames Update_Element (M, K).all; begin N := N + 1; end; Note that it would possible to get the automatic insertion behavior too, by passing the container as an access parameter: function Update_Element (Container : access Map; Key : in Key_Type) return access Element_Type; and then say: declare N : Natural renames Update_Element (M'Access, K).all; begin N := N + 1; end;