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!cleanfeed1-a.proxad.net!nnrp4-1.free.fr!not-for-mail From: Thomas Newsgroups: comp.lang.ada Mail-Copies-To: nobody Subject: 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> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Date: Wed, 06 Jul 2022 18:18:49 +0200 Message-ID: <62c5b5e9$0$22251$426a34cc@news.free.fr> Organization: Guest of ProXad - France NNTP-Posting-Date: 06 Jul 2022 18:18:49 CEST NNTP-Posting-Host: 91.175.52.121 X-Trace: 1657124329 news-4.free.fr 22251 91.175.52.121:12399 X-Complaints-To: abuse@proxad.net Xref: reader01.eternal-september.org comp.lang.ada:64080 List-Id: In article , Shark8 wrote: > On Wednesday, July 7, 2021 at 5:15:43 PM UTC-6, Matt Borchers wrote: > > BTW, what's wrong with > > Gnat.RegExp? It has worked in our code for years. > Regular expressions are for regular languages; it is very easy to violate > that restriction with your incoming data. > Most of my professional career has been doing maintenance, and RegEx are > *terrible* when it comes to maintainability, to the point that I actively > avoid them and advise others to as well, even for things that conceptually > *could* be done via RegEx (e.g. recognizing an Integer) in favor of actual > parsing... or if you need pattern-matching, something more robust like > SNOBOL. interesting :-) is it easy to integrate it in an ada program? i'm thinking about AdaControl, which (if i'm right) uses RegEx a lot. > > > 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); ... > and then I can use "Default_Map" instead of calling the generation-function > at each point and possibly messing things up should the parameters change.) why renames is better than constant in this case ? could you explicit the difference between them, please? -- RAPID maintainer http://savannah.nongnu.org/projects/rapid/