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.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE, XPRIO autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: RegEx / rename of a function result Date: Tue, 12 Jul 2022 01:54:43 -0500 Organization: A noiseless patient Spider Message-ID: 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> <62cc61d1$0$22254$426a34cc@news.free.fr> Injection-Date: Tue, 12 Jul 2022 06:54:45 -0000 (UTC) Injection-Info: reader01.eternal-september.org; posting-host="43c51df871ae43e4a0b6a5f8872fa98c"; logging-data="2090710"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ZfX6COqtczgB6GOqiYc/0eYFKCqFhnTQ=" Cancel-Lock: sha1:3ldYBUxevEX0OLXPDteYlkznAQI= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 X-Priority: 3 X-MSMail-Priority: Normal X-RFC2646: Format=Flowed; Original X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 Xref: reader01.eternal-september.org comp.lang.ada:64097 List-Id: "Thomas" wrote in message news:62cc61d1$0$22254$426a34cc@news.free.fr... .... > 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. With a renames, you *always* have to check the original object, since the properties specified in the renames are ignored in most cases. You *will* get in trouble if you pay attention to them. That's one reason for minimizing the use of renames (if your program can afford a copy, a copy is almost always safer anyway, and when it isn't you have to avoid aliasing and thus avoid renames). > 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" This is a False statement for Ada, (the details are painful), it's true for elementary types and some others, but not most composite types. > i suppose that some people already thought about that ... I don't recall anyone proposing this, but given the way renames works, it would either be useless or different from everything else. That's because a rename ignores the properties declared with it and use the ones of the actual object. In particular, things like subtypes are not used at all for a rename - even if specified. If you care about those things, you need to use a constant. :-) It would have been better if Ada had used some sort of matching rule, but Ada 83 did not have static matching, and it was too incompatible to introduce it in Ada 95, and that will not change. > 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. No problem, per se, just completely different than the current model of renames. If you think this is important, you should submit something via the new Community Input site. (Not announced yet, but should be working - it's in beta now, so if it fails, we need to know that.) See arg.adaic.org. Randy.