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,54889de51045a215 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-17 07:40:11 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stueberl.de!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: += in ada Date: Fri, 17 Oct 2003 14:40:10 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <3F7316F7.219F@mail.ru> <17cd177c.0310010606.52da88f3@posting.google.com> <3F8BC74F.2CFBFF37@0.0> <1066312000.671303@master.nyc.kbcfp.com> <1066322883.139702@master.nyc.kbcfp.com> <3F8F372D.9040801@comcast.net> <1066400123.238640@master.nyc.kbcfp.com> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1066401610 17254 217.17.192.37 (17 Oct 2003 14:40:10 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Fri, 17 Oct 2003 14:40:10 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:1079 Date: 2003-10-17T14:40:10+00:00 List-Id: * Hyman Rosen wrote: > No, you are forgetting that these operators are intended to > be defined for all sorts of types, where the temporaries may > be very large data structures, such as matrices. Ada provides 'in out' parameters of procedures for that purpose. > Anyway, I'm not an Ada programmer, so I don't really care if > Ada has these operators or not. If I had to do stuff like this > in Ada, I would just write the appropriate procedures and be > done with it. Please simply do this: procedure Mult_To_Left(target : in out Matrix; factor : in Matrix); > In C++, I use these operators all the time. You should stick to normal programming. It's much more funny than dealing with one syntatic element all the time. > I just did a quick search through the source code we've added to out > trading system and counted around 500 uses of augmented assignment > operators (+=, -=, *=, /=), and yes, we actually do have a few cases of > /=. We also have a few of those complicated left-hand sides that people > talk about; here's one: > > (*fxMap)[exposure.secCurr.id().get_key()] += exposure.secExp; declare fxExp : Fx_Type renames fxMap(exposure.secCurr.id.get_key); begin fxExp := fxExp + exposure.secExp; end; So what's your point? Ah! Multiple lines: procedure Add (to: in out Fx_Type; term : in Fx_Type) is begin to := to + term; end add; [...] Add(to => fxMap(exposure.secCurr.id.get_key), term => exposure.secExp); Add(fxMap(exposure.secCurr.id.get_key), exposure.secExp); Have fun.