From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.1 required=3.0 tests=AC_FROM_MANY_DOTS,BAYES_00, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!news.gegeweb.eu!gegeweb.org!pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-b.proxad.net!nnrp4-1.free.fr!not-for-mail From: Thomas Newsgroups: comp.lang.ada Mail-Copies-To: nobody Subject: Re: RegEx / rename of a function result References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com> <2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com> <4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com> <62c5b5e9$0$22251$426a34cc@news.free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Date: Mon, 11 Jul 2022 19:45:53 +0200 Message-ID: <62cc61d1$0$22254$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 11 Jul 2022 19:45:54 CEST NNTP-Posting-Host: 91.175.52.121 X-Trace: 1657561554 news-4.free.fr 22254 91.175.52.121:5339 X-Complaints-To: abuse@proxad.net Xref: reader01.eternal-september.org comp.lang.ada:64094 List-Id: In article , "Randy Brukardt" wrote: > "Thomas" wrote in message > news:62c5b5e9$0$22251$426a34cc@news.free.fr... > > In article , > > Shark8 wrote: > >> > The RENAME is interesting as I have not seen that before. Is it a > >> > rename of > >> > the function call (invokes the function upon reference) or a rename of > >> > the > >> > function result? > >> That form of RENAMES is the function result. > >> I've found it an excellent alternative to CONSTANT, as it signals my > >> intent > >> to have an alias for some result inside DECLARE blocks and certain > >> internal > >> objects. (eg Default_Map : Map renames Internal_Map_Generation(P1, P2); > > > > why renames is better than constant in this case ? > > could you explicit the difference between them, please? > > In theory, a renames captures the function result object, so for a composite > type, you avoid copying it. That can be especially significant for > controlled types, where you avoid an extra Finalization yes, i remember that i had to use a renames with a limited type :-) > I believe there also are some > accessibility differences that might matter in unusual cases. > it is a matter of preference which to pick. (I > usually use "constant" unless avoiding a copy is necessary.) (i don't know if that's the case of "some accessibility differences": ) i don't like that constant keyword is forbidden in a renames. i find it less readable when the pointed object is constant, since it is not remembered at the point of the renames, and one could think that it can be changed. in other words, at the review time we have to check at the source of the renames to know if it is constant or not. moreover, when the pointed object is variable, constant keyword in a renames could mean that the variable could not be modified when used with the "constant renames" identifier. i understand that it conflicts with the rule: "the constant keyword means that the value never changes" i suppose that some people already thought about that ... but i don't understant what kind of pb there can be with the 1st case, so i would find nice to have the constant keyword when the pointed object is one, even if it stay forbidden in the other case. (sorry for my english, I did not sleep well) -- RAPID maintainer http://savannah.nongnu.org/projects/rapid/