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,55f6e230b02eff2f X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Containers - nontrivial element access Date: Wed, 03 Oct 2007 20:16:33 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1191275759.184463.238350@n39g2000hsh.googlegroups.com> <1191343440.985588.143470@d55g2000hsg.googlegroups.com> <1191440425.737861.140360@50g2000hsm.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1191456994 14869 192.74.137.71 (4 Oct 2007 00:16:34 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Thu, 4 Oct 2007 00:16:34 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:1HKR/00Wij8mM6Hxlv7Ag7sA1qQ= Xref: g2news2.google.com comp.lang.ada:2285 Date: 2007-10-03T20:16:33-04:00 List-Id: Maciej Sobczak writes: > On 3 Pa , 02:20, "Jeffrey R. Carter" > wrote: > >> But since C/++ uses reference semantics, while Ada uses value semantics, >> this kind of mess is needed to get something in the C/++ spirit. > > Let's leave C++ aside then. > > Imagine I haven an *array* of Person(s) and I do this: > > Swap (People (X).Salary, People (Y).Salary); > > This is Ada. > > (is it value semantics for you, btw?) > > Now I want to do the same with vector. I agree with you on this point. Vector and array are basically the same thing (except vectors can grow), and it's annoying that you have to use different syntax to deal with them. In Ada, "array" is built in, and has all kinds of cool features (aggregates, with full-coverage checking, for example). It's annoying that vectors can't have all of those features. - Bob