Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

UFOs are for real: the Air Force doesn't exist.


devel / comp.lang.ada / deferred constants

SubjectAuthor
* deferred constantsMatt Borchers
+- Re: deferred constantsJeffrey R. Carter
+- Re: deferred constantsStephen Leake
`* Re: deferred constantsShark8
 `* Re: deferred constantsMatt Borchers
  +* Re: deferred constantsShark8
  |`* RegEx / rename of a function resultThomas
  | +* Re: RegEx / rename of a function resultJ-P. Rosen
  | |+* Re: RegEx / rename of a function resultJeffrey R.Carter
  | ||`- Re: RegEx / rename of a function resultRigJ-P. Rosen
  | |`* Re: RegEx / rename of a function resultThomas
  | | `* Re: RegEx / rename of a function resultJ-P. Rosen
  | |  `- Re: RegEx / rename of a function resultG.B.
  | `* Re: RegEx / rename of a function resultRandy Brukardt
  |  `* Re: RegEx / rename of a function resultThomas
  |   `- Re: RegEx / rename of a function resultRandy Brukardt
  `* Re: deferred constantsStephen Leake
   `- Re: deferred constantsMaxim Reznik

1
deferred constants

<5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5521&group=comp.lang.ada#5521

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:525a:: with SMTP id y26mr2527061qtn.254.1625686293714;
Wed, 07 Jul 2021 12:31:33 -0700 (PDT)
X-Received: by 2002:a25:ac9a:: with SMTP id x26mr35831900ybi.161.1625686293505;
Wed, 07 Jul 2021 12:31:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!2.eu.feeder.erje.net!feeder.erje.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 7 Jul 2021 12:31:33 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=209.104.249.61; posting-account=1tLBmgoAAAAfy5sC3GUezzrpVNronPA-
NNTP-Posting-Host: 209.104.249.61
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
Subject: deferred constants
From: mattborc...@gmail.com (Matt Borchers)
Injection-Date: Wed, 07 Jul 2021 19:31:33 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Matt Borchers - Wed, 7 Jul 2021 19:31 UTC

Is it possible to define a constant in a package body that has it's initialization deferred to elaboration?

For example...

with Gnat.RegExp;
package body
pat : constant Gnat.RegExp.RegExp;
begin
pat := Gnat.RegExp.compile( "..." );
end;

Obviously it is not strictly necessary to create 'pat' as a constant, but it is ideal to define symbols as precise as possible. Without it being a constant, the compiler will obviously not check to make sure someone has not inadvertently overwritten it.

GNAT gives me the following errors:
- constant declaration requires initialization expression
- deferred constant is frozen before completion

The first error message is not true, but comes from the fact that the second IS true. Is there a way to postpone the freezing of a symbol until after elaboration?

Re: deferred constants

<sc53fp$d6h$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5524&group=comp.lang.ada#5524

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.not.acm.org (Jeffrey R. Carter)
Newsgroups: comp.lang.ada
Subject: Re: deferred constants
Date: Wed, 7 Jul 2021 22:40:25 +0200
Organization: Also freenews.netfront.net; news.tornevall.net;
news.eternal-september.org
Lines: 30
Message-ID: <sc53fp$d6h$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 7 Jul 2021 20:40:26 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="6e3fbf440c30967a9a7e3c20fd18f2a9";
logging-data="13521"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OCfWpqN6rVhLOVWW2KSc7xPZ97JLlj1U="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.11.0
Cancel-Lock: sha1:eyrqafxum0CydcN0BJpszhM+1WA=
In-Reply-To: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R. Carter - Wed, 7 Jul 2021 20:40 UTC

On 7/7/21 9:31 PM, Matt Borchers wrote:
> Is it possible to define a constant in a package body that has it's initialization deferred to elaboration?
>
> with Gnat.RegExp;
> package body
> pat : constant Gnat.RegExp.RegExp;
> begin
> pat := Gnat.RegExp.compile( "..." );
> end;

Deferred constants are defined in ARM 7.4
(http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-7-4.html), which says they
may only appear in the visible part of a pkg spec, and the full declaration must
appear in the private part of the same pkg. So what you're trying is illegal.

In cases like this, you declare the object as a variable, with comments
indicating that it is set later and is then constant.

of course, in the example, one can simply do

Pat : constant Gnat.RegExp.RegExp := Gnat.RegExp.Compile ( "..." );

but there are cases where this is not possible.

--
Jeff Carter
"He had no conception of the instrument. He
was blowing into it."
Take the Money and Run
135

Re: deferred constants

<86zgux97rv.fsf@stephe-leake.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5525&group=comp.lang.ada#5525

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org.POSTED!not-for-mail
From: stephen_...@stephe-leake.org (Stephen Leake)
Newsgroups: comp.lang.ada
Subject: Re: deferred constants
Date: Wed, 07 Jul 2021 13:41:08 -0700
Organization: Aioe.org NNTP Server
Lines: 26
Message-ID: <86zgux97rv.fsf@stephe-leake.org>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
NNTP-Posting-Host: pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:iuFHT3IT1JJzxVYxEZ1eszPRjaI=
 by: Stephen Leake - Wed, 7 Jul 2021 20:41 UTC

Matt Borchers <mattborchers@gmail.com> writes:

> Is it possible to define a constant in a package body that has it's
> initialization deferred to elaboration?

No. It must be a variable.

> For example...
>
> with Gnat.RegExp;
> package body
> pat : constant Gnat.RegExp.RegExp;
> begin
> pat := Gnat.RegExp.compile( "..." );
> end;

What's wrong with this:

with Gnat.RegExp;
package body
pat : constant Gnat.RegExp.RegExp := Gnat.RegExp.compile( "..." );
end;

--
-- Stephe

Re: deferred constants

<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5526&group=comp.lang.ada#5526

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a0c:cd10:: with SMTP id b16mr25233411qvm.21.1625690672682;
Wed, 07 Jul 2021 13:44:32 -0700 (PDT)
X-Received: by 2002:a25:8081:: with SMTP id n1mr36238108ybk.253.1625690672523;
Wed, 07 Jul 2021 13:44:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 7 Jul 2021 13:44:32 -0700 (PDT)
In-Reply-To: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC
NNTP-Posting-Host: 146.5.2.231
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
Subject: Re: deferred constants
From: onewinge...@gmail.com (Shark8)
Injection-Date: Wed, 07 Jul 2021 20:44:32 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Shark8 - Wed, 7 Jul 2021 20:44 UTC

On Wednesday, July 7, 2021 at 1:31:34 PM UTC-6, Matt Borchers wrote:
> Is it possible to define a constant in a package body that has it's initialization deferred to elaboration?
>
> For example...
>
> with Gnat.RegExp;
> package body
> pat : constant Gnat.RegExp.RegExp;
> begin
> pat := Gnat.RegExp.compile( "..." );
> end;
>
> Obviously it is not strictly necessary to create 'pat' as a constant, but it is ideal to define symbols as precise as possible. Without it being a constant, the compiler will obviously not check to make sure someone has not inadvertently overwritten it.
>
> GNAT gives me the following errors:
> - constant declaration requires initialization expression
> - deferred constant is frozen before completion
>
> The first error message is not true, but comes from the fact that the second IS true. Is there a way to postpone the freezing of a symbol until after elaboration?
Use RENAMES?

pat : Gnat.RegExp.RegExp renames Gnat.RegExp.compile( "..." );

Other than this, I would advise not using RegEx.

Re: deferred constants

<4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5527&group=comp.lang.ada#5527

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:64c9:: with SMTP id y192mr20834621qkb.190.1625699742514; Wed, 07 Jul 2021 16:15:42 -0700 (PDT)
X-Received: by 2002:a25:dc50:: with SMTP id y77mr35682029ybe.405.1625699742319; Wed, 07 Jul 2021 16:15:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 7 Jul 2021 16:15:42 -0700 (PDT)
In-Reply-To: <2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:193:4101:a3a0:d572:63c2:a006:dae8; posting-account=1tLBmgoAAAAfy5sC3GUezzrpVNronPA-
NNTP-Posting-Host: 2601:193:4101:a3a0:d572:63c2:a006:dae8
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com> <2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
Subject: Re: deferred constants
From: mattborc...@gmail.com (Matt Borchers)
Injection-Date: Wed, 07 Jul 2021 23:15:42 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 19
 by: Matt Borchers - Wed, 7 Jul 2021 23:15 UTC

Of course comments help, but the compiler does not enforce what is written in comments. (That I'm aware of.)
The fact that the example uses RegExp doesn't matter, it was just code I ran across and the example could be anything. BTW, what's wrong with Gnat.RegExp? It has worked in our code for years.

I was looking at old code and began wondering if there was a new or better way to add protection to this entity. It appears not when it is defined in the elaboration block.

I suppose I could just move the call to 'compile' out of the begin block of the package as people have suggested. At what point do constants defined by a function call get elaborated? Before or after the elaboration block? Might I then potentially encounter a elaboration race condition?

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?

Matt

Re: deferred constants

<a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5528&group=comp.lang.ada#5528

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:1921:: with SMTP id es1mr26913807qvb.61.1625701042666;
Wed, 07 Jul 2021 16:37:22 -0700 (PDT)
X-Received: by 2002:a25:6b0c:: with SMTP id g12mr30726839ybc.303.1625701042480;
Wed, 07 Jul 2021 16:37:22 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 7 Jul 2021 16:37:22 -0700 (PDT)
In-Reply-To: <4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC
NNTP-Posting-Host: 146.5.2.231
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com> <4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>
Subject: Re: deferred constants
From: onewinge...@gmail.com (Shark8)
Injection-Date: Wed, 07 Jul 2021 23:37:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Shark8 - Wed, 7 Jul 2021 23:37 UTC

On Wednesday, July 7, 2021 at 5:15:43 PM UTC-6, Matt Borchers wrote:
> Of course comments help, but the compiler does not enforce what is written in comments. (That I'm aware of.)
> The fact that the example uses RegExp doesn't matter, it was just code I ran across and the example could be anything. 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.

> I was looking at old code and began wondering if there was a new or better way to add protection to this entity. It appears not when it is defined in the elaboration block.
> I suppose I could just move the call to 'compile' out of the begin block of the package as people have suggested. At what point do constants defined by a function call get elaborated? Before or after the elaboration block? Might I then potentially encounter a elaboration race condition?
This is where the categorization pragmas/aspects come in: if a package that you are depending on are PURE or PREELABORATE then there can be no elaboration error. If the type you are relying on is PREELABORABLE_INITIALIZATION, then there can be no elaboration error. All other conditions are a solid *maybe* on having an elaboration error.

> 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.)

Re: deferred constants

<86v95l8ush.fsf@stephe-leake.org>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5529&group=comp.lang.ada#5529

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org.POSTED!not-for-mail
From: stephen_...@stephe-leake.org (Stephen Leake)
Newsgroups: comp.lang.ada
Subject: Re: deferred constants
Date: Wed, 07 Jul 2021 18:21:34 -0700
Organization: Aioe.org NNTP Server
Lines: 22
Message-ID: <86v95l8ush.fsf@stephe-leake.org>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
<4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
NNTP-Posting-Host: pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain
X-Complaints-To: abuse@aioe.org
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)
Cancel-Lock: sha1:jme82x04v7KW+4ZdnaeKdOBnZWg=
X-Notice: Filtered by postfilter v. 0.9.2
 by: Stephen Leake - Thu, 8 Jul 2021 01:21 UTC

Matt Borchers <mattborchers@gmail.com> writes:

> I suppose I could just move the call to 'compile' out of the begin
> block of the package as people have suggested. At what point do
> constants defined by a function call get elaborated? Before or after
> the elaboration block? Might I then potentially encounter a
> elaboration race condition?

The Ada rules guarrantee no race condition, but sometimes fixing
elaboration order gets tricky. GNAT offers (at least) two elaboration
models; see the user guide. Normally, you just write the code, and only
worry about elaboration if the compiler reports a problem.

> 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?

The result; if the rename was in a block in a loop, the function be run
once for each iteration of the loop.

--
-- Stephe

Re: deferred constants

<189f0459-0c44-466d-94ee-8031c500c402n@googlegroups.com>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=5537&group=comp.lang.ada#5537

 copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:46d0:: with SMTP id h16mr705343qto.362.1625753922525;
Thu, 08 Jul 2021 07:18:42 -0700 (PDT)
X-Received: by 2002:a25:d4f:: with SMTP id 76mr41669502ybn.173.1625753922278;
Thu, 08 Jul 2021 07:18:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 8 Jul 2021 07:18:42 -0700 (PDT)
In-Reply-To: <86v95l8ush.fsf@stephe-leake.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2a03:7380:380d:3b:bc67:30e5:3eeb:f750;
posting-account=K1cP1QoAAAD_GR6kW2Td0NqGqGBLRE8h
NNTP-Posting-Host: 2a03:7380:380d:3b:bc67:30e5:3eeb:f750
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com> <4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
<86v95l8ush.fsf@stephe-leake.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <189f0459-0c44-466d-94ee-8031c500c402n@googlegroups.com>
Subject: Re: deferred constants
From: rezni...@gmail.com (Maxim Reznik)
Injection-Date: Thu, 08 Jul 2021 14:18:42 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Maxim Reznik - Thu, 8 Jul 2021 14:18 UTC

Just write a constant declaration. It will be initialized at elaboration time.

package body Pks is
pat : constant Gnat.RegExp.RegExp :=
Gnat.RegExp.compile( "..." );

RegEx / rename of a function result

<62c5b5e9$0$22251$426a34cc@news.free.fr>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7140&group=comp.lang.ada#7140

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed1-a.proxad.net!nnrp4-1.free.fr!not-for-mail
From: fantome....@free.fr.invalid (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> <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@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
Lines: 40
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
 by: Thomas - Wed, 6 Jul 2022 16:18 UTC

In article <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>,
Shark8 <onewingedshark@gmail.com> 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/

Re: RegEx / rename of a function result

<ta4icu$3hjj$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7141&group=comp.lang.ada#7141

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: RegEx / rename of a function result
Date: Wed, 6 Jul 2022 19:56:47 +0200
Organization: Adalog
Lines: 19
Message-ID: <ta4icu$3hjj$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
<4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
<a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>
<62c5b5e9$0$22251$426a34cc@news.free.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 6 Jul 2022 17:56:46 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="4b9bbff17fbcb950ac6ad5ad38480536";
logging-data="116339"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19kw/lY06K9NojiT+73uWya"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Cancel-Lock: sha1:4cRuNh/PZWe6unU+BKckZskUFvo=
Content-Language: fr
In-Reply-To: <62c5b5e9$0$22251$426a34cc@news.free.fr>
 by: J-P. Rosen - Wed, 6 Jul 2022 17:56 UTC

Le 06/07/2022 à 18:18, Thomas a écrit :
>> or if you need pattern-matching, something more robust like
>> SNOBOL.
> interesting:-)
I think AdaCore has (or used to have) a Snobol package. Snobol was
invented by Robert Dewar...

> is it easy to integrate it in an ada program?
> i'm thinking about AdaControl, which (if i'm right) uses RegEx a lot.
>
AdaControl uses Gnat.Regexp

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Re: RegEx / rename of a function result

<ta4mo6$422f$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7142&group=comp.lang.ada#7142

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrc...@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: RegEx / rename of a function result
Date: Wed, 6 Jul 2022 21:11:00 +0200
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <ta4mo6$422f$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
<4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
<a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>
<62c5b5e9$0$22251$426a34cc@news.free.fr> <ta4icu$3hjj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 6 Jul 2022 19:11:02 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="efedb6b75e81b0056f33acccbda1dbb9";
logging-data="133199"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/r9fNJln8JrPERKYpoFvuQMOIifCG4ke4="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:iueEv2D8jdnPCVglYMxm1h5iH2E=
In-Reply-To: <ta4icu$3hjj$1@dont-email.me>
Content-Language: en-US
 by: Jeffrey R.Carter - Wed, 6 Jul 2022 19:11 UTC

On 2022-07-06 19:56, J-P. Rosen wrote:
> I think AdaCore has (or used to have) a Snobol package. Snobol was invented by
> Robert Dewar...

SNOBOL was created by Farber,Griswold, and Polonsky in the 1960s. Dewar and
Belcher wrote the SPITBOL compiler in the 1970s. GNAT comes with the
GNAT.Spitbol.* packages for SNOBOL-like pattern matching.

--
Jeff Carter
"Monsieur Arthur King, who has the brain of a duck, you know."
Monty Python & the Holy Grail
09

Re: RegEx / rename of a function result

<ta5a8t$5vnn$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7143&group=comp.lang.ada#7143

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: RegEx / rename of a function result
Date: Wed, 6 Jul 2022 19:44:11 -0500
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <ta5a8t$5vnn$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com> <2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com> <4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com> <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com> <62c5b5e9$0$22251$426a34cc@news.free.fr>
Injection-Date: Thu, 7 Jul 2022 00:44:13 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="ceee2e7e5de0cef646c7637fea4c8611";
logging-data="196343"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18sb+TbjAnWWNXnwww9Sr4tlMmz4WZ++00="
Cancel-Lock: sha1:8JaARDx0OvJbCU0xF9wra3/N1Y4=
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-RFC2646: Format=Flowed; Original
X-MSMail-Priority: Normal
 by: Randy Brukardt - Thu, 7 Jul 2022 00:44 UTC

"Thomas" <fantome.forums.tDeContes@free.fr.invalid> wrote in message
news:62c5b5e9$0$22251$426a34cc@news.free.fr...
> In article <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>,
> Shark8 <onewingedshark@gmail.com> 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);
>> ...
>> 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?

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 (and that might be
critical if you are implementing Finalize). I believe there also are some
accessibility differences that might matter in unusual cases.

In most cases, however, they are essentially the same, generating
essentially the same code. So it is a matter of preference which to pick. (I
usually use "constant" unless avoiding a copy is necessary.)

Randy.

Re: RegEx / rename of a function resultRig

<ta5s83$a6rh$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7144&group=comp.lang.ada#7144

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: RegEx / rename of a function resultRig
Date: Thu, 7 Jul 2022 07:51:02 +0200
Organization: Adalog
Lines: 18
Message-ID: <ta5s83$a6rh$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
<4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
<a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>
<62c5b5e9$0$22251$426a34cc@news.free.fr> <ta4icu$3hjj$1@dont-email.me>
<ta4mo6$422f$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 7 Jul 2022 05:50:59 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a737571430180d08d1050e8f7718c516";
logging-data="334705"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/GNn5LL/Onx1bKN26UQM7r"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.10.0
Cancel-Lock: sha1:+G1zGqU7xgk4dN3LUiLMNA/27NE=
In-Reply-To: <ta4mo6$422f$1@dont-email.me>
Content-Language: fr
 by: J-P. Rosen - Thu, 7 Jul 2022 05:51 UTC

Le 06/07/2022 à 21:11, Jeffrey R.Carter a écrit :
> On 2022-07-06 19:56, J-P. Rosen wrote:
>> I think AdaCore has (or used to have) a Snobol package. Snobol was
>> invented by Robert Dewar...
>
> SNOBOL was created by Farber,Griswold, and Polonsky in the 1960s. Dewar
> and Belcher wrote the SPITBOL compiler in the 1970s. GNAT comes with the
> GNAT.Spitbol.* packages for SNOBOL-like pattern matching.
>

Right. I'm always confused which is which...

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Re: RegEx / rename of a function result

<62cc61d1$0$22254$426a34cc@news.free.fr>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7152&group=comp.lang.ada#7152

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.niel.me!pasdenom.info!nntpfeed.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-b.proxad.net!nnrp4-1.free.fr!not-for-mail
From: fantome....@free.fr.invalid (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> <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com> <62c5b5e9$0$22251$426a34cc@news.free.fr> <ta5a8t$5vnn$1@dont-email.me>
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
Lines: 69
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
 by: Thomas - Mon, 11 Jul 2022 17:45 UTC

In article <ta5a8t$5vnn$1@dont-email.me>,
"Randy Brukardt" <randy@rrsoftware.com> wrote:

> "Thomas" <fantome.forums.tDeContes@free.fr.invalid> wrote in message
> news:62c5b5e9$0$22251$426a34cc@news.free.fr...
> > In article <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>,
> > Shark8 <onewingedshark@gmail.com> 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/

Re: RegEx / rename of a function result

<62cc62a4$0$22254$426a34cc@news.free.fr>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7153&group=comp.lang.ada#7153

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!cleanfeed3-a.proxad.net!nnrp4-1.free.fr!not-for-mail
From: fantome....@free.fr.invalid (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> <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com> <62c5b5e9$0$22251$426a34cc@news.free.fr> <ta4icu$3hjj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)
Date: Mon, 11 Jul 2022 19:49:24 +0200
Lines: 23
Message-ID: <62cc62a4$0$22254$426a34cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 11 Jul 2022 19:49:24 CEST
NNTP-Posting-Host: 91.175.52.121
X-Trace: 1657561764 news-4.free.fr 22254 91.175.52.121:5339
X-Complaints-To: abuse@proxad.net
 by: Thomas - Mon, 11 Jul 2022 17:49 UTC

In article <ta4icu$3hjj$1@dont-email.me>,
"J-P. Rosen" <rosen@adalog.fr> wrote:

> Le 06/07/2022 à 18:18, Thomas a écrit :
> >> or if you need pattern-matching, something more robust like
> >> SNOBOL.
> > interesting:-)
> I think AdaCore has (or used to have) a Snobol package. Snobol was
> invented by Robert Dewar...
>
> > is it easy to integrate it in an ada program?
> > i'm thinking about AdaControl, which (if i'm right) uses RegEx a lot.
> >
> AdaControl uses Gnat.Regexp

do you have sth against SPITBOL?
do you disagree Shark8 ?

or is it because no one asked for it, or no time for that?

--
RAPID maintainer
http://savannah.nongnu.org/projects/rapid/

Re: RegEx / rename of a function result

<taivtv$1v8a8$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7154&group=comp.lang.ada#7154

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ros...@adalog.fr (J-P. Rosen)
Newsgroups: comp.lang.ada
Subject: Re: RegEx / rename of a function result
Date: Tue, 12 Jul 2022 07:13:36 +0200
Organization: Adalog
Lines: 15
Message-ID: <taivtv$1v8a8$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
<4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
<a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>
<62c5b5e9$0$22251$426a34cc@news.free.fr> <ta4icu$3hjj$1@dont-email.me>
<62cc62a4$0$22254$426a34cc@news.free.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 12 Jul 2022 05:13:35 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="4e1d5fcb072c7aa62f1824ebd4042f5b";
logging-data="2072904"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/209N5ApnuHC9fsPO5L6cm"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.0.1
Cancel-Lock: sha1:NdIyK1Hl8I9iiYEvqOUrd+cHnxE=
Content-Language: fr
In-Reply-To: <62cc62a4$0$22254$426a34cc@news.free.fr>
 by: J-P. Rosen - Tue, 12 Jul 2022 05:13 UTC

Le 11/07/2022 à 19:49, Thomas a écrit :
>> AdaControl uses Gnat.Regexp
> do you have sth against SPITBOL?No, but
1) Regexp is sufficient for my needs
2) I don't want my users to have to learn Spitbol. Everybody knows
regexp (at least the simple forms).

--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52
https://www.adalog.fr

Re: RegEx / rename of a function result

<taj5rl$1vpmm$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7155&group=comp.lang.ada#7155

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ran...@rrsoftware.com (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
Lines: 55
Message-ID: <taj5rl$1vpmm$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com> <2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com> <4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com> <a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com> <62c5b5e9$0$22251$426a34cc@news.free.fr> <ta5a8t$5vnn$1@dont-email.me> <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
 by: Randy Brukardt - Tue, 12 Jul 2022 06:54 UTC

"Thomas" <fantome.forums.tDeContes@free.fr.invalid> 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.

Re: RegEx / rename of a function result

<tak1dc$22hd8$1@dont-email.me>

 copy mid

https://www.novabbs.com/devel/article-flat.php?id=7157&group=comp.lang.ada#7157

 copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: bauh...@notmyhomepage.invalid (G.B.)
Newsgroups: comp.lang.ada
Subject: Re: RegEx / rename of a function result
Date: Tue, 12 Jul 2022 16:45:00 +0200
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <tak1dc$22hd8$1@dont-email.me>
References: <5db8eeb4-f3fc-49a7-b588-6a4b25bdbafcn@googlegroups.com>
<2e09faca-1f9a-43d3-99cb-6ae0e27a741cn@googlegroups.com>
<4333d2e6-a4f6-46a8-a5df-78bb4e0d915en@googlegroups.com>
<a6e2e912-8aa6-4ecf-9118-9dd29a967734n@googlegroups.com>
<62c5b5e9$0$22251$426a34cc@news.free.fr> <ta4icu$3hjj$1@dont-email.me>
<62cc62a4$0$22254$426a34cc@news.free.fr> <taivtv$1v8a8$1@dont-email.me>
Reply-To: nonlegitur@notmyhomepage.de
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 12 Jul 2022 14:45:00 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="bd4f9f4044147eec2f8f0b07daaeedf1";
logging-data="2180520"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX193YGfVQ0uFz53sLzx4Xz4yULZng++OO0o="
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0)
Gecko/20100101 Thunderbird/91.11.0
Cancel-Lock: sha1:mJ1HBZedAOoRySJ3aZnK9Y9CXo4=
Content-Language: en-US
In-Reply-To: <taivtv$1v8a8$1@dont-email.me>
 by: G.B. - Tue, 12 Jul 2022 14:45 UTC

On 12.07.22 07:13, J-P. Rosen wrote:
> Le 11/07/2022 à 19:49, Thomas a écrit :
> >> AdaControl uses Gnat.Regexp
> > do you have sth against SPITBOL?No, but
> 1) Regexp is sufficient for my needs
> 2) I don't want my users to have to learn Spitbol.

Learning Spitbol is great fun, though!

> Everybody knows regexp (at least the simple forms).

Everybody thinks they know regex (at least the simple forms)... ;-)

1
server_pubkey.txt

rocksolid light 0.9.7
clearnet tor