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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,eca91508b02e7e97 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!t-online.de!news-lei1.dfn.de!news1.uni-leipzig.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Amount of copying on returned constant objects Date: Mon, 18 Jun 2007 20:14:15 +0300 Message-ID: <5dnsr8F35f25mU1@mid.individual.net> References: <5dfsfnF1qav8bU1@mid.individual.net> <15bf7x8niwgcz.horig9zyjn4p.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: individual.net 8p2ewZpznho8hDa+FofoIgChENILiqsfMn9JKD62a9bu9nGuE= User-Agent: KNode/0.10.5 Xref: g2news1.google.com comp.lang.ada:16221 Date: 2007-06-18T20:14:15+03:00 List-Id: Dmitry A. Kazakov wrote: > On Fri, 15 Jun 2007 19:19:00 +0300, Alex R. Mosteo wrote: >> a) is there something in the ARM that prevents an equivalent transparent >> optimization in the Ada side (returning the reference when it is detected >> that the returned object is not modified)? > > No [*], but a way to help the compiler to know what you wanted is: > > declare > Item : Element renames Get (Collection, Key); > -- Please, don't make new objects, if you can > begin > ... -- Use Item And this gives me another question: is there any guarantee that renaming will avoid multiple calls, or implementation advice in this direction? I've tried to quickly find the answer in 8.5.4 but I guess I'm not specially suited for ARM reading today, since I don't see it clearly.