Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

A bug in the code is worth two in the documentation.


devel / comp.lang.ada / Re: Ada Pure or Preelaborate or ? in Adare_net

SubjectAuthor
* Ada Pure or Preelaborate or ? in Adare_netDaniel Norte Moraes
+* Re: Ada Pure or Preelaborate or ? in Adare_netSimon Belmont
|`- Re: Ada Pure or Preelaborate or ? in Adare_netDaniel Norte Moraes
`* Re: Ada Pure or Preelaborate or ? in Adare_netFabien Chouteau
 `* Re: Ada Pure or Preelaborate or ? in Adare_netDaniel Norte Moraes
  `* Re: Ada Pure or Preelaborate or ? in Adare_netRandy Brukardt
   `- Re: Ada Pure or Preelaborate or ? in Adare_netDaniel Norte Moraes

1
Ada Pure or Preelaborate or ? in Adare_net

<3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:bd05:: with SMTP id n5mr24626491qkf.293.1640967212099;
Fri, 31 Dec 2021 08:13:32 -0800 (PST)
X-Received: by 2002:a25:9003:: with SMTP id s3mr26703585ybl.323.1640967211948;
Fri, 31 Dec 2021 08:13:31 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Fri, 31 Dec 2021 08:13:31 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=2804:14c:4c1:8775:352d:ffd4:3db5:6282;
posting-account=wgmHdgoAAAA-F7JItPEZjeXqFc0KdzEQ
NNTP-Posting-Host: 2804:14c:4c1:8775:352d:ffd4:3db5:6282
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com>
Subject: Ada Pure or Preelaborate or ? in Adare_net
From: danielch...@gmail.com (Daniel Norte Moraes)
Injection-Date: Fri, 31 Dec 2021 16:13:32 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 17
 by: Daniel Norte Moraes - Fri, 31 Dec 2021 16:13 UTC

Hi!

I and a friend created an Ada network lib where,
from the begining, we tried very hard to make It a Ada Pure.

From the examples dir, the lib worked as expected (in gcc-10.2 gcc-11.2 and gcc-12).
To our surprise, what most caught the attention of the group's friends was the fact that the lib was Ada Pure and if that was correct.

For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.

link: https://gitlab.com/daresoft/network/adare_net/-/tree/202x
for Ada version use 2012 and or 202x.

Best Wishes and Happy New Year,
Dani.

Re: Ada Pure or Preelaborate or ? in Adare_net

<15ffbb15-6f0b-4f61-8740-f100d9e384bbn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:372a:: with SMTP id de42mr34613539qkb.14.1641258696445;
Mon, 03 Jan 2022 17:11:36 -0800 (PST)
X-Received: by 2002:a25:c401:: with SMTP id u1mr56084948ybf.498.1641258696283;
Mon, 03 Jan 2022 17:11:36 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Mon, 3 Jan 2022 17:11:36 -0800 (PST)
In-Reply-To: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=159.250.202.227; posting-account=ShYTIAoAAABytvcS76ZrG9GdaV-nXYKy
NNTP-Posting-Host: 159.250.202.227
References: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <15ffbb15-6f0b-4f61-8740-f100d9e384bbn@googlegroups.com>
Subject: Re: Ada Pure or Preelaborate or ? in Adare_net
From: sbelmont...@gmail.com (Simon Belmont)
Injection-Date: Tue, 04 Jan 2022 01:11:36 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 35
 by: Simon Belmont - Tue, 4 Jan 2022 01:11 UTC

On Friday, December 31, 2021 at 11:13:33 AM UTC-5, daniel...@gmail.com wrote:
> Hi!
>
> I and a friend created an Ada network lib where,
> from the begining, we tried very hard to make It a Ada Pure.
>
> From the examples dir, the lib worked as expected (in gcc-10.2 gcc-11.2 and gcc-12).
> To our surprise, what most caught the attention of the group's friends was the fact that the lib was Ada Pure and if that was correct.
>
> For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.
>
> link: https://gitlab.com/daresoft/network/adare_net/-/tree/202x
> for Ada version use 2012 and or 202x.
>
> Best Wishes and Happy New Year,
> Dani.

It seems to be mostly just a thin binding to a bunch of C functions, so the applicability of any Ada feature is mostly a moot point. The Ada compiler has no control or visibility into the C domain, so while on the one hand your packages are technically Pure, on the other hand the C functions can violate those "purity rules" all they want, which might be misleading to users expecting otherwise. You don't use 'Unchecked_Access either, but obviously that doesn't mean the C functions are somehow prevented from creating dangling pointers. Personally, I would have the interfaces reflect the reality of the actual behavior (which in the case of C code you don't control, is usually assume-the-worst).

-sb

Re: Ada Pure or Preelaborate or ? in Adare_net

<546e54e7-64ba-48a5-a990-d644947992ccn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:208:: with SMTP id b8mr44579248qtx.326.1641304361932;
Tue, 04 Jan 2022 05:52:41 -0800 (PST)
X-Received: by 2002:a05:6902:102a:: with SMTP id x10mr32484793ybt.305.1641304361642;
Tue, 04 Jan 2022 05:52:41 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Tue, 4 Jan 2022 05:52:41 -0800 (PST)
In-Reply-To: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=89.157.139.225; posting-account=L3mulQoAAADsXVjCD5rM6Ap3Xy0U3ckB
NNTP-Posting-Host: 89.157.139.225
References: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <546e54e7-64ba-48a5-a990-d644947992ccn@googlegroups.com>
Subject: Re: Ada Pure or Preelaborate or ? in Adare_net
From: fabien.c...@gmail.com (Fabien Chouteau)
Injection-Date: Tue, 04 Jan 2022 13:52:41 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 5
 by: Fabien Chouteau - Tue, 4 Jan 2022 13:52 UTC

On Friday, December 31, 2021 at 5:13:33 PM UTC+1, daniel...@gmail.com wrote:
> For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.

I recommend reading this: https://stackoverflow.com/questions/19353228/when-to-use-pragma-pure-preelaborate

If your units are declared as Pure, the compiler considers that they have no side effect and can decided to call the sub-programs only once and cache the result, or not even call the sub-program if the result is not used after.

Re: Ada Pure or Preelaborate or ? in Adare_net

<98855f15-6bc3-4575-8a89-709175b5f7b8n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:5dc8:: with SMTP id m8mr50412480qvh.71.1641399112493;
Wed, 05 Jan 2022 08:11:52 -0800 (PST)
X-Received: by 2002:a25:ba05:: with SMTP id t5mr70633728ybg.675.1641399112316;
Wed, 05 Jan 2022 08:11:52 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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, 5 Jan 2022 08:11:52 -0800 (PST)
In-Reply-To: <15ffbb15-6f0b-4f61-8740-f100d9e384bbn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2804:14c:4c1:8775:352d:ffd4:3db5:6282;
posting-account=wgmHdgoAAAA-F7JItPEZjeXqFc0KdzEQ
NNTP-Posting-Host: 2804:14c:4c1:8775:352d:ffd4:3db5:6282
References: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com> <15ffbb15-6f0b-4f61-8740-f100d9e384bbn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <98855f15-6bc3-4575-8a89-709175b5f7b8n@googlegroups.com>
Subject: Re: Ada Pure or Preelaborate or ? in Adare_net
From: danielch...@gmail.com (Daniel Norte Moraes)
Injection-Date: Wed, 05 Jan 2022 16:11:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 52
 by: Daniel Norte Moraes - Wed, 5 Jan 2022 16:11 UTC

Em segunda-feira, 3 de janeiro de 2022 às 22:11:37 UTC-3, Simon Belmont escreveu:
> On Friday, December 31, 2021 at 11:13:33 AM UTC-5, daniel...@gmail.com wrote:
> > Hi!
> >
> > I and a friend created an Ada network lib where,
> > from the begining, we tried very hard to make It a Ada Pure.
> >
> > From the examples dir, the lib worked as expected (in gcc-10.2 gcc-11.2 and gcc-12).
> > To our surprise, what most caught the attention of the group's friends was the fact that the lib was Ada Pure and if that was correct.
> >
> > For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.
> >
> > link: https://gitlab.com/daresoft/network/adare_net/-/tree/202x
> > for Ada version use 2012 and or 202x.
> >
> > Best Wishes and Happy New Year,
> > Dani.
> It seems to be mostly just a thin binding to a bunch of C functions, so the applicability of any Ada feature is mostly a moot point. The Ada compiler has no control or visibility into the C domain, so while on the one hand your packages are technically Pure, on the other hand the C functions can violate those "purity rules" all they want, which might be misleading to users expecting otherwise. You don't use 'Unchecked_Access either, but obviously that doesn't mean the C functions are somehow prevented from creating dangling pointers. Personally, I would have the interfaces reflect the reality of the actual behavior (which in the case of C code you don't control, is usually assume-the-worst).
>
> -sb

Thanks !

The C pointers are only created in c_initialize_socket.c (c_init_address() ) and data pointed copied
to an ada array, and then immediately free by c part. this is the only time there is a dynamic allocation.
We managed to make libadare_net very close to 100% static allocation!
Because this, don´t are dangling pointers.

There is still the problem of omitting the execution of subprograms by the compiler by pure packages.
would 'preelaborate' solve this?

Thanks!

Best Wishes,
Dani.

Re: Ada Pure or Preelaborate or ? in Adare_net

<378bc69a-8388-4daf-b13f-523fd1defa12n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:6113:: with SMTP id v19mr39059147qkb.333.1641400439740;
Wed, 05 Jan 2022 08:33:59 -0800 (PST)
X-Received: by 2002:a25:6884:: with SMTP id d126mr44060642ybc.355.1641400438136;
Wed, 05 Jan 2022 08:33:58 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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, 5 Jan 2022 08:33:57 -0800 (PST)
In-Reply-To: <546e54e7-64ba-48a5-a990-d644947992ccn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2804:14c:4c1:8775:352d:ffd4:3db5:6282;
posting-account=wgmHdgoAAAA-F7JItPEZjeXqFc0KdzEQ
NNTP-Posting-Host: 2804:14c:4c1:8775:352d:ffd4:3db5:6282
References: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com> <546e54e7-64ba-48a5-a990-d644947992ccn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <378bc69a-8388-4daf-b13f-523fd1defa12n@googlegroups.com>
Subject: Re: Ada Pure or Preelaborate or ? in Adare_net
From: danielch...@gmail.com (Daniel Norte Moraes)
Injection-Date: Wed, 05 Jan 2022 16:33:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 25
 by: Daniel Norte Moraes - Wed, 5 Jan 2022 16:33 UTC

Em terça-feira, 4 de janeiro de 2022 às 10:52:42 UTC-3, Fabien Chouteau escreveu:
> On Friday, December 31, 2021 at 5:13:33 PM UTC+1, daniel...@gmail.com wrote:
> > For this reason, if really 'is' pure, not pure, preelaborate or what (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help analyze and suggest modifications if necessary.
> I recommend reading this: https://stackoverflow.com/questions/19353228/when-to-use-pragma-pure-preelaborate
>
> If your units are declared as Pure, the compiler considers that they have no side effect and can decided to call the sub-programs only once and cache the result, or not even call the sub-program if the result is not used after.

Thanks!
I read the post and believe that because most variables are either streamed or aliased and imported, lib works as it should.
However, there is still the possible problem of omitting the same subprograms with the same parameters (by compiler), although in the tests this did not happen, would replacing aspect 'pure' by 'preelaborate' solve this possible problem?

Thanks!
Best Whishes,
Dani.

Re: Ada Pure or Preelaborate or ? in Adare_net

<sr5a8l$eua$1@franka.jacob-sparre.dk>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!paganini.bofh.team!newsfeed.xs3.de!callisto.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail
From: ran...@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Ada Pure or Preelaborate or ? in Adare_net
Date: Wed, 5 Jan 2022 17:40:04 -0600
Organization: JSA Research & Innovation
Lines: 33
Message-ID: <sr5a8l$eua$1@franka.jacob-sparre.dk>
References: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com> <546e54e7-64ba-48a5-a990-d644947992ccn@googlegroups.com> <378bc69a-8388-4daf-b13f-523fd1defa12n@googlegroups.com>
Injection-Date: Wed, 5 Jan 2022 23:40:06 -0000 (UTC)
Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226";
logging-data="15306"; mail-complaints-to="news@jacob-sparre.dk"
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
 by: Randy Brukardt - Wed, 5 Jan 2022 23:40 UTC

"Daniel Norte Moraes" <danielcheagle@gmail.com> wrote in message
news:378bc69a-8388-4daf-b13f-523fd1defa12n@googlegroups.com...
>Em ter�a-feira, 4 de janeiro de 2022 �s 10:52:42 UTC-3, Fabien Chouteau
>escreveu:
>> On Friday, December 31, 2021 at 5:13:33 PM UTC+1, daniel...@gmail.com
>> wrote:
>> > For this reason, if really 'is' pure, not pure, preelaborate or what
>> > (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help
>> > analyze and suggest modifications if necessary.
>> I recommend reading this:
>> https://stackoverflow.com/questions/19353228/when-to-use-pragma-pure-preelaborate
>>
>> If your units are declared as Pure, the compiler considers that they have
>> no side effect and can decided to call the sub-programs only once and
>> cache the result, or not even call the sub-program if the result is not
>> used after.

>Thanks!
>I read the post and believe that because most variables are either streamed
>or aliased and imported, lib works as it should.
>However, there is still the possible problem of omitting the same
>subprograms with the same parameters (by compiler), although in the tests
>this did not happen, would replacing aspect 'pure' by 'preelaborate' solve
>this possible problem?

Yes. The permission to omit calls only applies to Pure (see 10.2.1(18/3)).
http://www.ada-auth.org/standards/2xaarm/html/AA-10-2-1.html#p18. (I gave a
reference to the Ada 2022 AARM, but this rule hasn't changed in spirit since
it was introduced in Ada 95.)

Randy.

Re: Ada Pure or Preelaborate or ? in Adare_net

<f2611eaa-96ea-4c50-a97a-a8fef1e62b6an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:1477:: with SMTP id j23mr44078560qkl.152.1641501562268;
Thu, 06 Jan 2022 12:39:22 -0800 (PST)
X-Received: by 2002:a25:e052:: with SMTP id x79mr2814566ybg.323.1641501562035;
Thu, 06 Jan 2022 12:39:22 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.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: Thu, 6 Jan 2022 12:39:21 -0800 (PST)
In-Reply-To: <sr5a8l$eua$1@franka.jacob-sparre.dk>
Injection-Info: google-groups.googlegroups.com; posting-host=2804:14c:4c1:8775:352d:ffd4:3db5:6282;
posting-account=wgmHdgoAAAA-F7JItPEZjeXqFc0KdzEQ
NNTP-Posting-Host: 2804:14c:4c1:8775:352d:ffd4:3db5:6282
References: <3b7ba153-ebf1-4b85-a1b2-3ad5aaeca11en@googlegroups.com>
<546e54e7-64ba-48a5-a990-d644947992ccn@googlegroups.com> <378bc69a-8388-4daf-b13f-523fd1defa12n@googlegroups.com>
<sr5a8l$eua$1@franka.jacob-sparre.dk>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f2611eaa-96ea-4c50-a97a-a8fef1e62b6an@googlegroups.com>
Subject: Re: Ada Pure or Preelaborate or ? in Adare_net
From: danielch...@gmail.com (Daniel Norte Moraes)
Injection-Date: Thu, 06 Jan 2022 20:39:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 57
 by: Daniel Norte Moraes - Thu, 6 Jan 2022 20:39 UTC

Em quarta-feira, 5 de janeiro de 2022 às 20:40:08 UTC-3, Randy Brukardt escreveu:
> "Daniel Norte Moraes" <daniel...@gmail.com> wrote in message
> news:378bc69a-8388-4daf...@googlegroups.com...
> >Em terça-feira, 4 de janeiro de 2022 às 10:52:42 UTC-3, Fabien Chouteau
> >escreveu:
> >> On Friday, December 31, 2021 at 5:13:33 PM UTC+1, daniel...@gmail.com
> >> wrote:
> >> > For this reason, if really 'is' pure, not pure, preelaborate or what
> >> > (?), pleeeeeeaaase, we ask the group's Ada Language Lawyers to help
> >> > analyze and suggest modifications if necessary.
> >> I recommend reading this:
> >> https://stackoverflow.com/questions/19353228/when-to-use-pragma-pure-preelaborate
> >>
> >> If your units are declared as Pure, the compiler considers that they have
> >> no side effect and can decided to call the sub-programs only once and
> >> cache the result, or not even call the sub-program if the result is not
> >> used after.
>
> >Thanks!
> >I read the post and believe that because most variables are either streamed
> >or aliased and imported, lib works as it should.
> >However, there is still the possible problem of omitting the same
> >subprograms with the same parameters (by compiler), although in the tests
> >this did not happen, would replacing aspect 'pure' by 'preelaborate' solve
> >this possible problem?
> Yes. The permission to omit calls only applies to Pure (see 10.2.1(18/3))..
> http://www.ada-auth.org/standards/2xaarm/html/AA-10-2-1.html#p18. (I gave a
> reference to the Ada 2022 AARM, but this rule hasn't changed in spirit since
> it was introduced in Ada 95.)
>
> Randy.

Thanks!

We will change the packages in LibAdare_Net to 'preelaborate'. :-)
and continue from here.

Thanks All,
Best Whishes,
Dani.

Enjoy!! :-)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor