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!news.glorb.com!wns14feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.6 (Windows/20070728) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Containers - nontrivial element access References: <1191275759.184463.238350@n39g2000hsh.googlegroups.com> <1191358254.405682.320670@22g2000hsm.googlegroups.com> <4hBMi.132431$Fc.72735@attbi_s21> <10xbnt0vkcyeo.5t72qwg3umwd.dlg@40tude.net> In-Reply-To: <10xbnt0vkcyeo.5t72qwg3umwd.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1191437398 12.201.97.213 (Wed, 03 Oct 2007 18:49:58 GMT) NNTP-Posting-Date: Wed, 03 Oct 2007 18:49:58 GMT Organization: AT&T ASP.att.net Date: Wed, 03 Oct 2007 18:49:58 GMT Xref: g2news2.google.com comp.lang.ada:2267 Date: 2007-10-03T18:49:58+00:00 List-Id: Dmitry A. Kazakov wrote: > > How so? Ada abstracts by-value/reference issue away (except for some > special cases). Whether an in-out parameter is passed by reference or by > value is not a question of sematic in Ada. I'm not discussing parameter-passing mechanisms. > This is IMO utterly wrong. The semantics of swapping element's fields is > well-defined independently on the way of access. In question in not the > semantics of, but the syntax sugar, namely an array-like indexing of the > container. Swapping was only an example. Essentially, the OP was looking for the ability to do People.Element (X).Salary := S; and have it modify the value in the data structure. C++ uses reference semantics, so that a modification of a field modifies the value in the data structure. Ada uses value semantics, so that modification of a field does not modify the value in the data structure. -- Jeff Carter "Spam! Spam! Spam! Spam! Spam! Spam! Spam! Spam!" Monty Python's Flying Circus 53