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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,604e0f87aa06eab6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-24 21:04:05 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: amir@iae.nsk.su (Amir Yantimirov) Newsgroups: comp.lang.ada Subject: Re: Imitation is the sincerest form of flattery Date: 24 Mar 2003 21:04:04 -0800 Organization: http://groups.google.com/ Message-ID: <5115eb96.0303242104.5825a33e@posting.google.com> References: <4dkea.75440$gi1.38045@nwrdny02.gnilink.net> <1048524746.273345@master.nyc.kbcfp.com> <1048530794.5794@master.nyc.kbcfp.com> NNTP-Posting-Host: 81.1.215.198 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1048568645 12331 127.0.0.1 (25 Mar 2003 05:04:05 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 25 Mar 2003 05:04:05 GMT Xref: archiver1.google.com comp.lang.ada:35665 Date: 2003-03-25T05:04:05+00:00 List-Id: Hyman Rosen wrote in message news:<1048530794.5794@master.nyc.kbcfp.com>... > Dmitry A. Kazakov wrote: > > IMO. The idea of treating > > A[i]=X; > > as > > Assign (Index (A, i), X); > > is a wrong one. > > Why? In particular, this technique is used very often in C++, > especially with expression templates. One has Index(A,i) just > return a proxy class which holds A and i, and implements the > Assign to take such a class. Inline expansion does the rest, > usually resulting in code that looks like an open-coded version. It may be said that any access/reference is too strong contract. Luckily it is available for free for one-address-space code and comparatively safe for one-thread one and efficient and simple, yes. For more complex cases there are property arrays thats don't have reference semantics and can cover bits access as well. Amir Yantimirov http://www174.pair.com/yamir/programming/