Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Those who can, do; those who can't, write. Those who can't write work for the Bell Labs Record.


devel / comp.lang.ada / Calling inherited primitive operations in Ada

SubjectAuthor
* Calling inherited primitive operations in AdaEmmanuel Briot
+- Re: Calling inherited primitive operations in AdaDrPi
`* Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
 `* Re: Calling inherited primitive operations in AdaEmmanuel Briot
  `* Re: Calling inherited primitive operations in Adaamo...@unizar.es
   +- Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
   `* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
    `* Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
     `* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
      `* Re: Calling inherited primitive operations in AdaEmmanuel Briot
       +- Re: Calling inherited primitive operations in Adaamo...@unizar.es
       `* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
        `* Re: Calling inherited primitive operations in AdaEmmanuel Briot
         `* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
          `* Re: Calling inherited primitive operations in AdaEmmanuel Briot
           `* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
            +* Re: Calling inherited primitive operations in AdaEmmanuel Briot
            |+* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
            ||`* Re: Calling inherited primitive operations in AdaEmmanuel Briot
            || +- Re: Calling inherited primitive operations in AdaJeffrey R.Carter
            || `- Re: Calling inherited primitive operations in AdaRandy Brukardt
            |`* Re: Calling inherited primitive operations in AdaRandy Brukardt
            | +* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
            | |`- Re: Calling inherited primitive operations in AdaRandy Brukardt
            | `* Re: Calling inherited primitive operations in AdaSimon Wright
            |  `* Re: Calling inherited primitive operations in AdaEmmanuel Briot
            |   +- Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
            |   +- Re: Calling inherited primitive operations in AdaJeffrey R.Carter
            |   `- Re: Calling inherited primitive operations in AdaRandy Brukardt
            `* Re: Calling inherited primitive operations in Adaamo...@unizar.es
             +* Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
             |`* Re: Calling inherited primitive operations in Adaamo...@unizar.es
             | `- Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
             +* Re: Calling inherited primitive operations in AdaJeffrey R.Carter
             |`* Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
             | `* Re: Calling inherited primitive operations in AdaRandy Brukardt
             |  `- Re: Calling inherited primitive operations in AdaDmitry A. Kazakov
             `* Re: Calling inherited primitive operations in AdaRandy Brukardt
              `* Re: Calling inherited primitive operations in Adaamo...@unizar.es
               `- Re: Calling inherited primitive operations in Adaamo...@unizar.es

Pages:12
Calling inherited primitive operations in Ada

<a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:14cd:b0:344:6cfa:42f9 with SMTP id u13-20020a05622a14cd00b003446cfa42f9mr18219883qtx.147.1661933739196;
Wed, 31 Aug 2022 01:15:39 -0700 (PDT)
X-Received: by 2002:a5b:790:0:b0:671:5d18:3a3 with SMTP id b16-20020a5b0790000000b006715d1803a3mr14733690ybq.169.1661933738823;
Wed, 31 Aug 2022 01:15:38 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 31 Aug 2022 01:15:38 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:e466:bce8:63d7:5e6c;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:e466:bce8:63d7:5e6c
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
Subject: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Wed, 31 Aug 2022 08:15:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1396
 by: Emmanuel Briot - Wed, 31 Aug 2022 08:15 UTC

A small blog post that you might find interesting:

https://deepbluecap.com/calling-inherited-primitive-operations-in-ada/

We are preparing a number of other posts, but right now this is the only one on our web site, so the links are a bit hidden. They will become available on https://deepbluecap.com/blog/ as we publish them.

Emmanuel

Re: Calling inherited primitive operations in Ada

<630f9639$0$25820$426a74cc@news.free.fr>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!news.niel.me!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp2-2.free.fr!not-for-mail
Date: Wed, 31 Aug 2022 19:11:20 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.2.0
Subject: Re: Calling inherited primitive operations in Ada
Content-Language: fr, en-GB
Newsgroups: comp.lang.ada
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
From: 314@drpi.fr (DrPi)
In-Reply-To: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Lines: 16
Message-ID: <630f9639$0$25820$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 31 Aug 2022 19:11:21 CEST
NNTP-Posting-Host: 82.65.30.55
X-Trace: 1661965881 news-3.free.fr 25820 82.65.30.55:54774
X-Complaints-To: abuse@proxad.net
 by: DrPi - Wed, 31 Aug 2022 17:11 UTC

Le 31/08/2022 à 10:15, Emmanuel Briot a écrit :
> A small blog post that you might find interesting:
>
> https://deepbluecap.com/calling-inherited-primitive-operations-in-ada/
>
> We are preparing a number of other posts, but right now this is the only one on our web site, so the links are a bit hidden. They will become available on https://deepbluecap.com/blog/ as we publish them.
>
> Emmanuel

That's interesting.

You should compile all excerpts of code you publish. This will avoid
typos like "Polgyon" ;)

Nicolas

Re: Calling inherited primitive operations in Ada

<teobs9$dkt$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!wkzB5gFOhLHjvUsb32RKWQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Wed, 31 Aug 2022 21:13:14 +0200
Organization: Aioe.org NNTP Server
Message-ID: <teobs9$dkt$1@gioia.aioe.org>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="13981"; posting-host="wkzB5gFOhLHjvUsb32RKWQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Wed, 31 Aug 2022 19:13 UTC

On 2022-08-31 10:15, Emmanuel Briot wrote:
> A small blog post that you might find interesting:
>
> https://deepbluecap.com/calling-inherited-primitive-operations-in-ada/

This same technique is used in generics to work around another language
design "feature":

generic
type Foo is ...;
package
subtype Actual_Foo is Foo;

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Calling inherited primitive operations in Ada

<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:d82:b0:477:3d7c:1081 with SMTP id e2-20020a0562140d8200b004773d7c1081mr22967984qve.28.1662015387658;
Wed, 31 Aug 2022 23:56:27 -0700 (PDT)
X-Received: by 2002:a25:2649:0:b0:696:4270:277c with SMTP id
m70-20020a252649000000b006964270277cmr18761799ybm.217.1662015387190; Wed, 31
Aug 2022 23:56:27 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Wed, 31 Aug 2022 23:56:26 -0700 (PDT)
In-Reply-To: <teobs9$dkt$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:e466:bce8:63d7:5e6c;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:e466:bce8:63d7:5e6c
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com> <teobs9$dkt$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Thu, 01 Sep 2022 06:56:27 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1620
 by: Emmanuel Briot - Thu, 1 Sep 2022 06:56 UTC

> generic
> type Foo is ...;
> package
> subtype Actual_Foo is Foo;

To me, this is an orthogonal issue though (which would be worth its own blog post in fact). I can never remember (or perhaps not even understand) the reason for this limitation in Ada, which is a major pain when dealing with generics indeed...
I like the "Actual_" prefix, which I assume is some sort of convention in your code.

Emmanuel

Re: Calling inherited primitive operations in Ada

<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:2806:b0:6b8:eced:ba3a with SMTP id f6-20020a05620a280600b006b8ecedba3amr18150819qkp.462.1662019054022;
Thu, 01 Sep 2022 00:57:34 -0700 (PDT)
X-Received: by 2002:a25:71c2:0:b0:681:63ae:4c48 with SMTP id
m185-20020a2571c2000000b0068163ae4c48mr18242567ybc.578.1662019053721; Thu, 01
Sep 2022 00:57:33 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.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, 1 Sep 2022 00:57:33 -0700 (PDT)
In-Reply-To: <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=155.210.248.194; posting-account=SuyozQoAAADXnDELfODTBs7QDv_fdf87
NNTP-Posting-Host: 155.210.248.194
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: amosteo@unizar.es (amo...@unizar.es)
Injection-Date: Thu, 01 Sep 2022 07:57:34 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 8
 by: amo...@unizar.es - Thu, 1 Sep 2022 07:57 UTC

On Thursday, September 1, 2022 at 8:56:28 AM UTC+2, briot.e...@gmail.com wrote:
> > generic
> > type Foo is ...;
> > package
> > subtype Actual_Foo is Foo;
> To me, this is an orthogonal issue though (which would be worth its own blog post in fact). I can never remember (or perhaps not even understand) the reason for this limitation in Ada, which is a major pain when dealing with generics indeed...
> I like the "Actual_" prefix, which I assume is some sort of convention in your code.

Is this about how according to some mystifying rules generic formals are[n't] visible from outside the generic?

Re: Calling inherited primitive operations in Ada

<teq003$ovo$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!wkzB5gFOhLHjvUsb32RKWQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Thu, 1 Sep 2022 12:02:43 +0200
Organization: Aioe.org NNTP Server
Message-ID: <teq003$ovo$1@gioia.aioe.org>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="25592"; posting-host="wkzB5gFOhLHjvUsb32RKWQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Thu, 1 Sep 2022 10:02 UTC

On 2022-09-01 09:57, amo...@unizar.es wrote:
> On Thursday, September 1, 2022 at 8:56:28 AM UTC+2, briot.e...@gmail.com wrote:
>>> generic
>>> type Foo is ...;
>>> package
>>> subtype Actual_Foo is Foo;
>> To me, this is an orthogonal issue though (which would be worth its own blog post in fact). I can never remember (or perhaps not even understand) the reason for this limitation in Ada, which is a major pain when dealing with generics indeed...
>> I like the "Actual_" prefix, which I assume is some sort of convention in your code.
>
> Is this about how according to some mystifying rules generic formals are[n't] visible from outside the generic?

Right. I do not remember the rules, just the fact that they are quite
logical. Unfortunately the logic of is not very helpful. (:-))

As for primitive operations the problems are on many levels, from
lacking introspection to missing inheritance of implementation by
composition (AKA hooking).

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Calling inherited primitive operations in Ada

<teq6r1$262s2$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Thu, 1 Sep 2022 13:59:29 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <teq6r1$262s2$1@dont-email.me>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 1 Sep 2022 11:59:29 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="45300621dee1fc91cb38e31b4cd7878a";
logging-data="2296706"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+6lLu50L+f5mNQNLCp2B773jbQAt6i9SQ="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:wmPyzv14UyIGI4GsVIA5BRaNYEg=
Content-Language: en-US
In-Reply-To: <67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
 by: Jeffrey R.Carter - Thu, 1 Sep 2022 11:59 UTC

On 2022-09-01 09:57, amo...@unizar.es wrote:
>
> Is this about how according to some mystifying rules generic formals are[n't] visible from outside the generic?

This seems like a non-issue to me. Any code that has visibility to a generic
instance knows the actuals used for that instance. Can anyone provide real
examples where this is a problem?

--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

Re: Calling inherited primitive operations in Ada

<teq92g$ru9$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!wkzB5gFOhLHjvUsb32RKWQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Thu, 1 Sep 2022 14:37:36 +0200
Organization: Aioe.org NNTP Server
Message-ID: <teq92g$ru9$1@gioia.aioe.org>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="28617"; posting-host="wkzB5gFOhLHjvUsb32RKWQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Dmitry A. Kazakov - Thu, 1 Sep 2022 12:37 UTC

On 2022-09-01 13:59, Jeffrey R.Carter wrote:
> On 2022-09-01 09:57, amo...@unizar.es wrote:
>>
>> Is this about how according to some mystifying rules generic formals
>> are[n't] visible from outside the generic?
>
> This seems like a non-issue to me. Any code that has visibility to a
> generic instance knows the actuals used for that instance.

That would make the code fragile. Should be avoided as much as possible
as a form of aliasing. Compare:

procedure A (X : Integer) is
procedure B (Y : Integer) is
begin
X := 1; -- We know we are going to call it with X!
end B;
begin
B (X);
end A;

> Can anyone
> provide real examples where this is a problem?

Defaulted formal package actual part:

generic
package Foo is new Bar (<>);
package Baz is ...
-- What were these actuals in Foo?

This is one of most useful features used to reduce lists of formal
parameters and simplify instantiations.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Calling inherited primitive operations in Ada

<teqci9$26ntr$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Thu, 1 Sep 2022 15:37:12 +0200
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <teqci9$26ntr$1@dont-email.me>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 1 Sep 2022 13:37:13 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="45300621dee1fc91cb38e31b4cd7878a";
logging-data="2318267"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18pdLa1iOlNEqOSOALep3Q7GkCrssbSf2Y="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:yktkDKd1un63gsZQtkIR4CQ9b30=
Content-Language: en-US
In-Reply-To: <teq92g$ru9$1@gioia.aioe.org>
 by: Jeffrey R.Carter - Thu, 1 Sep 2022 13:37 UTC

On 2022-09-01 14:37, Dmitry A. Kazakov wrote:
>

Toy problem ignored.

>> Can anyone provide real examples where this is a problem?
>
> Defaulted formal package actual part:
>
>    generic
>       package Foo is new Bar (<>);
>    package Baz is ...
>       -- What were these actuals in Foo?

1. The actuals of Foo are visible within Baz.
2. This is not a real example.
3. You have changed the subject from needing to rename a formal type. I presume
this is because there are no real examples where renaming a formal type in an
instance is needed.

--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

Re: Calling inherited primitive operations in Ada

<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ae9:e404:0:b0:6bb:d8c0:381c with SMTP id q4-20020ae9e404000000b006bbd8c0381cmr19659119qkc.459.1662041512683;
Thu, 01 Sep 2022 07:11:52 -0700 (PDT)
X-Received: by 2002:a81:de4f:0:b0:340:c3d1:3ef1 with SMTP id
o15-20020a81de4f000000b00340c3d13ef1mr20673028ywl.509.1662041403305; Thu, 01
Sep 2022 07:10:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 1 Sep 2022 07:10:03 -0700 (PDT)
In-Reply-To: <teqci9$26ntr$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:2863:e1f:40fd:f3da;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:2863:e1f:40fd:f3da
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Thu, 01 Sep 2022 14:11:52 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5115
 by: Emmanuel Briot - Thu, 1 Sep 2022 14:10 UTC

I have seen quite a number of cases of needing the subtype like Dmitry was showing. In a small number of cases, those were actual bugs in GNAT, but most of the time the compiler was correct.
Mostly, you start to see the issue when you have generic packages that have formal generic packages.

Here is a quick example and the corresponding compiler error message. In Main, there is no way to see T. Of course, I can use Integer_Signature
directly, but this is an issue.
- if I rename Integer_Signature then I have to change a lot of places in my code (The aliasing that Dmitry was talking about)

with Signature;
generic
with package Sign is new Signature (<>);
package Algo is
procedure Compute (V : Sign.T) is null;
end Algo;

with Algo;
with Signature;
package Lib is
package Integer_Signature is new Signature (Integer);
package Integer_Algo is new Algo (Integer_Signature);
end Lib;

with Lib;
procedure Main is
V : Lib.Integer_Algo.Sign.T;
-- main.adb:3:24: "Sign" is not a visible entity of "Integer_Algo"
begin
null;
end Main;

generic
type T is private;
package Signature is
end Signature;

There are more interesting examples, somehow this one doesn't seem that bad.. So here is another one:

generic
type T is private;
package Gen is
end Gen;

with Gen;
generic
type T is private;
with package Must_Match is new Gen (T);
with package Need_Not_Match is new Gen (<>);
package Gen2 is
V1 : Must_Match.T; -- "T" is not a visible entity of "Must_Match"
V2 : Need_Not_Match.T; -- instance of same package, but this time T is visible
end Gen2;

with Gen, Gen2;
procedure P2 is
package G is new Gen (Integer);
package G2 is new Gen2 (Integer, G, G);
begin
null;
end P2;

I dug out the explanation that Tucker Taft once sent to the Ada-Comment mailing list (2019-11-14):

<<<
10/2
{AI95-00317-01} The visible part of a formal package includes the first list of basic_declarative_items of the package_specification. In addition, for each actual parameter that is not required to match, a copy of the declaration of the corresponding formal parameter of the template is included in the visible part of the formal package. If the copied declaration is for a formal type, copies of the implicit declarations of the primitive subprograms of the formal type are also included in the visible part of the formal package.
10.a/2
Ramification: {AI95-00317-01} If the formal_package_actual_part is (<>), then the declarations that occur immediately within the generic_formal_part of the template for the formal package are visible outside the formal package, and can be denoted by expanded names outside the formal package.If only some of the actual parameters are given by <>, then the declaration corresponding to those parameters (but not the others) are made visible.
10.b/3
Reason: {AI05-0005-1} We always want either the actuals or the formals of an instance to be nameable from outside, but never both. If both were nameable, one would get some funny anomalies since they denote the same entity, but, in the case of types at least, they might have different and inconsistent sets of primitive operators due to predefined operator “reemergence.” Formal derived types exacerbate the difference. We want the implicit declarations of the generic_formal_part as well as the explicit declarations, so we get operations on the formal types.
>>>

Re: Calling inherited primitive operations in Ada

<8716804b-8041-4aae-ba48-276cecce7881n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:164b:b0:344:513b:ffc0 with SMTP id y11-20020a05622a164b00b00344513bffc0mr24585820qtj.350.1662047422162;
Thu, 01 Sep 2022 08:50:22 -0700 (PDT)
X-Received: by 2002:a81:6cd7:0:b0:33d:cd0f:123a with SMTP id
h206-20020a816cd7000000b0033dcd0f123amr23376440ywc.422.1662047421900; Thu, 01
Sep 2022 08:50:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 1 Sep 2022 08:50:21 -0700 (PDT)
In-Reply-To: <401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=91.250.172.85; posting-account=SuyozQoAAADXnDELfODTBs7QDv_fdf87
NNTP-Posting-Host: 91.250.172.85
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me> <401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8716804b-8041-4aae-ba48-276cecce7881n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: amosteo@unizar.es (amo...@unizar.es)
Injection-Date: Thu, 01 Sep 2022 15:50:22 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 5216
 by: amo...@unizar.es - Thu, 1 Sep 2022 15:50 UTC

On Thursday, September 1, 2022 at 4:11:54 PM UTC+2, briot.e...@gmail.com wrote:
> I have seen quite a number of cases of needing the subtype like Dmitry was showing. In a small number of cases, those were actual bugs in GNAT, but most of the time the compiler was correct.
> Mostly, you start to see the issue when you have generic packages that have formal generic packages.

This matches exactly my experience. I don't have enough grasp of the details to come up with a realistic short example, but I did hit this issue pretty often in two libs were I used signature packages quite extensively:

https://github.com/mosteo/rxada
https://github.com/mosteo/iterators

Initially I was always under the impression I was hitting GNAT bugs but then it turned out there were rules about it. A couple example places (you can see the renamings at the top. I was adding them "on demand" so to say):

https://github.com/mosteo/iterators/blob/master/src/iterators-traits-containers.ads
https://github.com/mosteo/rxada/blob/master/src/priv/rx-impl-transformers.ads
Thanks Emmanuel for the examples and digging out Tucker explanation.

-Alex.

> There are more interesting examples, somehow this one doesn't seem that bad. So here is another one:
>
> generic
> type T is private;
> package Gen is
> end Gen;
>
> with Gen;
> generic
> type T is private;
> with package Must_Match is new Gen (T);
> with package Need_Not_Match is new Gen (<>);
> package Gen2 is
> V1 : Must_Match.T; -- "T" is not a visible entity of "Must_Match"
> V2 : Need_Not_Match.T; -- instance of same package, but this time T is visible
> end Gen2;
>
> with Gen, Gen2;
> procedure P2 is
> package G is new Gen (Integer);
> package G2 is new Gen2 (Integer, G, G);
> begin
> null;
> end P2;
>
>
>
>
> I dug out the explanation that Tucker Taft once sent to the Ada-Comment mailing list (2019-11-14):
>
> <<<
> 10/2
> {AI95-00317-01} The visible part of a formal package includes the first list of basic_declarative_items of the package_specification. In addition, for each actual parameter that is not required to match, a copy of the declaration of the corresponding formal parameter of the template is included in the visible part of the formal package. If the copied declaration is for a formal type, copies of the implicit declarations of the primitive subprograms of the formal type are also included in the visible part of the formal package.
> 10.a/2
> Ramification: {AI95-00317-01} If the formal_package_actual_part is (<>), then the declarations that occur immediately within the generic_formal_part of the template for the formal package are visible outside the formal package, and can be denoted by expanded names outside the formal package.If only some of the actual parameters are given by <>, then the declaration corresponding to those parameters (but not the others) are made visible.
> 10.b/3
> Reason: {AI05-0005-1} We always want either the actuals or the formals of an instance to be nameable from outside, but never both. If both were nameable, one would get some funny anomalies since they denote the same entity, but, in the case of types at least, they might have different and inconsistent sets of primitive operators due to predefined operator “reemergence.” Formal derived types exacerbate the difference. We want the implicit declarations of the generic_formal_part as well as the explicit declarations, so we get operations on the formal types.
> >>>

Re: Calling inherited primitive operations in Ada

<teql47$27jv6$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Thu, 1 Sep 2022 18:03:19 +0200
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <teql47$27jv6$1@dont-email.me>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 1 Sep 2022 16:03:19 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="45300621dee1fc91cb38e31b4cd7878a";
logging-data="2346982"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19g42gf+WH5zmv99cqBEO6yObfYeEUMq9o="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:iBPxASbuCIlUoy7Zn70XuO0fLtE=
In-Reply-To: <401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Thu, 1 Sep 2022 16:03 UTC

On 2022-09-01 16:10, Emmanuel Briot wrote:
> I have seen quite a number of cases of needing the subtype like Dmitry was showing. In a small number of cases, those were actual bugs in GNAT, but most of the time the compiler was correct.
> Mostly, you start to see the issue when you have generic packages that have formal generic packages.

None of these deal with the example I responded to

generic
type T is ...
package P is
subtype Actual_T is T;

> Reason: {AI05-0005-1} We always want either the actuals or the formals of an instance to be nameable from outside, but never both.
This is true in all these examples. I have used Ada since 1984, and this has
never been a problem for me (as initially presented, this would have existed in
Ada 83). Of course, I generally avoid generic formal pkgs. They seem to me to be
a work around for poor design, and I prefer to correct the design.

--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

Re: Calling inherited primitive operations in Ada

<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ae9:ed89:0:b0:6bb:9968:de30 with SMTP id c131-20020ae9ed89000000b006bb9968de30mr19552884qkg.774.1662048430461;
Thu, 01 Sep 2022 09:07:10 -0700 (PDT)
X-Received: by 2002:a0d:c307:0:b0:335:6fff:dc70 with SMTP id
f7-20020a0dc307000000b003356fffdc70mr23317016ywd.493.1662048430191; Thu, 01
Sep 2022 09:07:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border-2.nntp.ord.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, 1 Sep 2022 09:07:09 -0700 (PDT)
In-Reply-To: <teql47$27jv6$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:2863:e1f:40fd:f3da;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:2863:e1f:40fd:f3da
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com> <teql47$27jv6$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Thu, 01 Sep 2022 16:07:10 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 7
 by: Emmanuel Briot - Thu, 1 Sep 2022 16:07 UTC

On Thursday, September 1, 2022 at 6:03:22 PM UTC+2, Jeffrey R.Carter wrote:
> This is true in all these examples. I have used Ada since 1984, and this has
> never been a problem for me (as initially presented, this would have existed in

So basically saying that you do not use generics (or only very basic versions) and you have never seen
the bug that relates to complex generics. Not very useful input ?
For sure, that's already a number of persons who have said they have seen this bug a number of times.
I have of course only been using Ada for 25 years, but that sure was enough to see that issue...

Re: Calling inherited primitive operations in Ada

<teqlu3$27mlk$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Thu, 1 Sep 2022 18:17:06 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <teqlu3$27mlk$1@dont-email.me>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
<teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 1 Sep 2022 16:17:07 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="45300621dee1fc91cb38e31b4cd7878a";
logging-data="2349748"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19TDC0+LdKDlZdO9400MNAKE/Sh1sryFd0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:65MZvhb8Z6+I1ZjUhc7HaqWXo6Y=
Content-Language: en-US
In-Reply-To: <12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
 by: Jeffrey R.Carter - Thu, 1 Sep 2022 16:17 UTC

On 2022-09-01 18:07, Emmanuel Briot wrote:
>
> So basically saying that you do not use generics (or only very basic versions) and you have never seen
> the bug that relates to complex generics. Not very useful input ?

I have not said this. I have worked on very large problems and on generics
appropriate to such problems. Of course, KISS is an important S/W-eng principle.

--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

Re: Calling inherited primitive operations in Ada

<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:54f:0:b0:6ba:5369:5c5a with SMTP id 76-20020a37054f000000b006ba53695c5amr20278329qkf.253.1662058441550;
Thu, 01 Sep 2022 11:54:01 -0700 (PDT)
X-Received: by 2002:a25:42c6:0:b0:696:1721:d3a with SMTP id
p189-20020a2542c6000000b0069617210d3amr19098626yba.28.1662058441285; Thu, 01
Sep 2022 11:54:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 1 Sep 2022 11:54:00 -0700 (PDT)
In-Reply-To: <teqlu3$27mlk$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:2863:e1f:40fd:f3da;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:2863:e1f:40fd:f3da
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com> <teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com> <teqlu3$27mlk$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Thu, 01 Sep 2022 18:54:01 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3051
 by: Emmanuel Briot - Thu, 1 Sep 2022 18:54 UTC

I think I have a more interesting example. This one is extracted from my attempted traits containers, for which I had published a blog post at AdaCore.. My enhanced fork of the library is at
https://github.com/briot/ada-traits-containers
if someone wants to experiment with non-trivial generics code (and containers are of course a case where generics fully make sense).

Here is the example:

generic
type Element_Type is private;
type Stored_Type is private;
package Elements is
end Elements;

with Elements;
generic
type Element_Type is private;
package Definite_Elements is
package Traits is new Elements (Element_Type, Stored_Type => Element_Type);
end Definite_Elements;

with Definite_Elements;
generic
type Key_Type is private;
package Maps is
package Keys is new Definite_Elements (Key_Type);
function "=" (L, R : Keys.Traits.Stored_Type) return Boolean -- "Stored_Type" is not a visible entity of "Traits"
is (False);
end Maps;

This is not case where the actual is visible unless I happen to know how Definite_Element is implemented and that it will use Element_Type for Stored_Type (and this is not a knowledge I wish client packages to have, the whole point of Element and Definite_Element is to basically hide how elements can be stored in a container, and whether we need memory allocation for instance).

Re: Calling inherited primitive operations in Ada

<ter8fo$29nsd$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Thu, 1 Sep 2022 23:33:44 +0200
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <ter8fo$29nsd$1@dont-email.me>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
<teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
<teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 1 Sep 2022 21:33:44 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="6a715631b025ee876628b22ef6a76d67";
logging-data="2416525"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/jZVpX7mz0XgH68H91rFXvlXXeaUvZ04="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:ZJoVCqHmDA8Ry81O3euG2LfzLF0=
Content-Language: en-US
In-Reply-To: <dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
 by: Jeffrey R.Carter - Thu, 1 Sep 2022 21:33 UTC

On 2022-09-01 20:54, Emmanuel Briot wrote:
>
> generic
> type Element_Type is private;
> type Stored_Type is private;
> package Elements is
> end Elements;
>
> with Elements;
> generic
> type Element_Type is private;
> package Definite_Elements is
> package Traits is new Elements (Element_Type, Stored_Type => Element_Type);
> end Definite_Elements;
>
> with Definite_Elements;
> generic
> type Key_Type is private;
> package Maps is
> package Keys is new Definite_Elements (Key_Type);
> function "=" (L, R : Keys.Traits.Stored_Type) return Boolean -- "Stored_Type" is not a visible entity of "Traits"
> is (False);
> end Maps;

As presented, this seems very over complicated. Elements and Definite_Elements
add no value, and this is just a complex way of writing

generic
type Key is private;
package Maps is
function "=" (L : in Key; R : in Key) return Boolean is (False);
end Maps;

One hopes that the actual library makes better use of these pkgs than this small
example.

> This is not case where the actual is visible unless I happen to know how Definite_Element is implemented and that it will use Element_Type for Stored_Type (and this is not a knowledge I wish client packages to have, the whole point of Element and Definite_Element is to basically hide how elements can be stored in a container, and whether we need memory allocation for instance).

Ada has excellent features for hiding, but these are not among them. Assuming
that pkg Keys serves some actual role in the spec of Maps, then someone wanting
to use pkg Maps will need to understand that role, which involves understanding
Definite_Elements, which involves understanding pkg Traits, which involves
understanding Elements. Rather than hiding anything, you are effectively
requiring your users to look at these things, even if you could use the notation
in question.

--
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

Re: Calling inherited primitive operations in Ada

<b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:306:b0:343:416d:76ae with SMTP id q6-20020a05622a030600b00343416d76aemr27314551qtw.337.1662099106234;
Thu, 01 Sep 2022 23:11:46 -0700 (PDT)
X-Received: by 2002:a25:2649:0:b0:696:4270:277c with SMTP id
m70-20020a252649000000b006964270277cmr22557837ybm.217.1662099105991; Thu, 01
Sep 2022 23:11:45 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Thu, 1 Sep 2022 23:11:45 -0700 (PDT)
In-Reply-To: <ter8fo$29nsd$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:2863:e1f:40fd:f3da;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:2863:e1f:40fd:f3da
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com> <teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com> <teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com> <ter8fo$29nsd$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Fri, 02 Sep 2022 06:11:46 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3464
 by: Emmanuel Briot - Fri, 2 Sep 2022 06:11 UTC

> As presented, this seems very over complicated. Elements and Definite_Elements
> add no value, and this is just a complex way of writing

I did point you to the full repository if you prefer an extensive, real-life code sample. This was just an extract showing the gist of the issue.

> One hopes that the actual library makes better use of these pkgs than this small
> example.

One can check the full code and extensive documentation on the design in the github repository.
This is called code reuse, was invented quite a while ago.
These packages are mostly implementation details. They are used to build high-level packages similar to the Ada containers, except with much better code reuse, more efficient, and SPARK-provable.

> Ada has excellent features for hiding, but these are not among them. Assuming

And that's exactly our point in this discussion. Ada on the whole is very good (we would not be using it otherwise), but it does have a number of limitations which are sometimes a pain, this being one of them. Not acknowledging the limitations when they exist is naive, all languages have them.

> that pkg Keys serves some actual role in the spec of Maps, then someone wanting
> to use pkg Maps will need to understand that role, which involves understanding
> Definite_Elements, which involves understanding pkg Traits, which involves
> understanding Elements.

which involves understanding Ada, which involves understanding the compiler, which involves understanding the kernel sources, ...
How many times have you checked the whole sources of the GNAT runtime to understand how they implemented the Ada containers ?

Emmanuel

Re: Calling inherited primitive operations in Ada

<672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:a843:0:b0:6c3:3902:a346 with SMTP id r64-20020a37a843000000b006c33902a346mr467064qke.538.1662107712275;
Fri, 02 Sep 2022 01:35:12 -0700 (PDT)
X-Received: by 2002:a81:6309:0:b0:323:6fd9:8f36 with SMTP id
x9-20020a816309000000b003236fd98f36mr25285762ywb.96.1662107711991; Fri, 02
Sep 2022 01:35:11 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 2 Sep 2022 01:35:11 -0700 (PDT)
In-Reply-To: <ter8fo$29nsd$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=155.210.248.194; posting-account=SuyozQoAAADXnDELfODTBs7QDv_fdf87
NNTP-Posting-Host: 155.210.248.194
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com> <teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com> <teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com> <ter8fo$29nsd$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: amosteo@unizar.es (amo...@unizar.es)
Injection-Date: Fri, 02 Sep 2022 08:35:12 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 3359
 by: amo...@unizar.es - Fri, 2 Sep 2022 08:35 UTC

On Thursday, September 1, 2022 at 11:33:47 PM UTC+2, Jeffrey R.Carter wrote:
> On 2022-09-01 20:54, Emmanuel Briot wrote:

> As presented, this seems very over complicated. Elements and Definite_Elements
> add no value, and this is just a complex way of writing

Going in a tangent, and I guess you know perfectly well, but this is caused by the painful duplication of code that Ada pushes you to by not having a native way to abstract storage of definite vs indefinite types. So the provider of a generic library very soon faces this conundrum about duplicating most interfaces, if not implementations, or resort to non-trivial generics, or accept an unnecessary penalty for definite types, or push to the client the definite storage matter. There's simply no satisfying solution here [that I know of]. The duplication of every standard container to have both [in]definite variants is a strong indictment.

I can understand the desire to have full control of allocation and object sizes, but that there's not a language way to work around this duplication, with appropriate restrictions to go with it, is... bothersome. Not making a dig at the ARG, which I understand is overstretched as it is.

There was a proposal circulating some time ago that seemed promising, that I can't quickly find. Something like

type Blah is record
Dont_care_if_in_heap: new Whatever_Definiteness; -- Would apply to indefinite types or formals
end record;

I don't think it made into https://github.com/AdaCore/ada-spark-rfcs/ or https://github.com/Ada-Rapporteur-Group/User-Community-Input/issues or I can't find it.

Re: Calling inherited primitive operations in Ada

<tesg1k$1i84$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!wkzB5gFOhLHjvUsb32RKWQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 10:48:53 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tesg1k$1i84$1@gioia.aioe.org>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
<teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
<teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
<ter8fo$29nsd$1@dont-email.me>
<672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="51460"; posting-host="wkzB5gFOhLHjvUsb32RKWQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Dmitry A. Kazakov - Fri, 2 Sep 2022 08:48 UTC

On 2022-09-02 10:35, amo...@unizar.es wrote:
> On Thursday, September 1, 2022 at 11:33:47 PM UTC+2, Jeffrey R.Carter wrote:
>> On 2022-09-01 20:54, Emmanuel Briot wrote:
>
>> As presented, this seems very over complicated. Elements and Definite_Elements
>> add no value, and this is just a complex way of writing
>
> Going in a tangent, and I guess you know perfectly well, but this is caused by the painful duplication of code that Ada pushes you to by not having a native way to abstract storage of definite vs indefinite types. So the provider of a generic library very soon faces this conundrum about duplicating most interfaces, if not implementations, or resort to non-trivial generics, or accept an unnecessary penalty for definite types, or push to the client the definite storage matter. There's simply no satisfying solution here [that I know of]. The duplication of every standard container to have both [in]definite variants is a strong indictment.
>
> I can understand the desire to have full control of allocation and object sizes, but that there's not a language way to work around this duplication, with appropriate restrictions to go with it, is... bothersome. Not making a dig at the ARG, which I understand is overstretched as it is.

Containers should be implementable without generics. Just saying.

> There was a proposal circulating some time ago that seemed promising, that I can't quickly find. Something like
>
> type Blah is record
> Dont_care_if_in_heap: new Whatever_Definiteness; -- Would apply to indefinite types or formals
> end record;

I would prefer constraint propagation/management support + tuples instead:

type Blah (Parameters : Whatever_Definiteness'Constraints) is
Sill_Care : Whatever_Definiteness (Parameters);
end record;

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Calling inherited primitive operations in Ada

<9484a755-f55d-407e-a40b-92421b0bcafbn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:d4d:b0:499:2037:3be9 with SMTP id 13-20020a0562140d4d00b0049920373be9mr9821066qvr.121.1662110445280;
Fri, 02 Sep 2022 02:20:45 -0700 (PDT)
X-Received: by 2002:a81:4b55:0:b0:341:98fa:33a0 with SMTP id
y82-20020a814b55000000b0034198fa33a0mr13811571ywa.169.1662110444959; Fri, 02
Sep 2022 02:20:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 2 Sep 2022 02:20:44 -0700 (PDT)
In-Reply-To: <tesg1k$1i84$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=155.210.248.194; posting-account=SuyozQoAAADXnDELfODTBs7QDv_fdf87
NNTP-Posting-Host: 155.210.248.194
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com> <teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com> <teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com> <ter8fo$29nsd$1@dont-email.me>
<672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com> <tesg1k$1i84$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <9484a755-f55d-407e-a40b-92421b0bcafbn@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: amosteo@unizar.es (amo...@unizar.es)
Injection-Date: Fri, 02 Sep 2022 09:20:45 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2212
 by: amo...@unizar.es - Fri, 2 Sep 2022 09:20 UTC

On Friday, September 2, 2022 at 10:48:57 AM UTC+2, Dmitry A. Kazakov wrote:

> Containers should be implementable without generics. Just saying.

Are you now referring to current Ada or to hypothetical features?

> I would prefer constraint propagation/management support + tuples instead:
>
> type Blah (Parameters : Whatever_Definiteness'Constraints) is
> Sill_Care : Whatever_Definiteness (Parameters);
> end record;

Whatever ;-) as long as it's an effective solution.

Re: Calling inherited primitive operations in Ada

<tesjtu$1asj$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!wkzB5gFOhLHjvUsb32RKWQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 11:55:11 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tesjtu$1asj$1@gioia.aioe.org>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
<teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
<teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
<ter8fo$29nsd$1@dont-email.me>
<672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com>
<tesg1k$1i84$1@gioia.aioe.org>
<9484a755-f55d-407e-a40b-92421b0bcafbn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="43923"; posting-host="wkzB5gFOhLHjvUsb32RKWQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Dmitry A. Kazakov - Fri, 2 Sep 2022 09:55 UTC

On 2022-09-02 11:20, amo...@unizar.es wrote:
> On Friday, September 2, 2022 at 10:48:57 AM UTC+2, Dmitry A. Kazakov wrote:
>
>> Containers should be implementable without generics. Just saying.
>
> Are you now referring to current Ada or to hypothetical features?

Hypothetical like all types having classes and supertypes. E.g. when you
instantiate generic with a type you semantically place the type in the
implicit class of formal types of the generic. You cannot do that now
without generics. Furthermore, there is no way to describe relationships
between types like array index and array, like range and discrete type
of its elements etc.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Calling inherited primitive operations in Ada

<tesml6$2goms$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 12:41:42 +0200
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <tesml6$2goms$1@dont-email.me>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
<teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
<teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
<ter8fo$29nsd$1@dont-email.me>
<672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 2 Sep 2022 10:41:42 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="6ac1cbe18cfe3e0fa2de74f64dfd3996";
logging-data="2646748"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+X49bXHNNbVkoyzfk0bxCR9g7iTByZsTs="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:G/PLmxQqTtAFnWy5IUOLnJZSeFg=
In-Reply-To: <672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Fri, 2 Sep 2022 10:41 UTC

On 2022-09-02 10:35, amo...@unizar.es wrote:
>
> Going in a tangent, and I guess you know perfectly well, but this is caused by the painful duplication of code that Ada pushes you to by not having a native way to abstract storage of definite vs indefinite types. So the provider of a generic library very soon faces this conundrum about duplicating most interfaces, if not implementations, or resort to non-trivial generics, or accept an unnecessary penalty for definite types, or push to the client the definite storage matter. There's simply no satisfying solution here [that I know of]. The duplication of every standard container to have both [in]definite variants is a strong indictment.

The only indefinite data structure that is needed seems to be holders. Any other
indefinite data structure can be implemented as the equivalent definite data
structure of holders, so there need be no duplication of implementations. That
one cannot use a single pkg for both does result in duplication of the spec, but
that seems like less of an issue to me.

--
Jeff Carter
"Apple juice and Darvon is fantastic together."
Play It Again, Sam
127

Re: Calling inherited primitive operations in Ada

<tesneh$2gr8m$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: spam.jrcarter.not@spam.acm.org.not (Jeffrey R.Carter)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 12:55:13 +0200
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <tesneh$2gr8m$1@dont-email.me>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
<teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
<teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
<ter8fo$29nsd$1@dont-email.me>
<b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 2 Sep 2022 10:55:14 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="6ac1cbe18cfe3e0fa2de74f64dfd3996";
logging-data="2649366"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+osmCt0hb3e2Irr2ajAnzaRhu84b6QTec="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:mDFzPZPT+wHOawYe0Vnr56yasGY=
In-Reply-To: <b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Fri, 2 Sep 2022 10:55 UTC

On 2022-09-02 08:11, Emmanuel Briot wrote:
>
> I did point you to the full repository if you prefer an extensive, real-life code sample. This was just an extract showing the gist of the issue.
>
> One can check the full code and extensive documentation on the design in the github repository.

Yes, I looked at it, and found it over complicated, difficult to understand, and
not user friendly. There appears to be extensive HTML documentation, but it can
only be viewed as HTML source in Github, which is not easy to read, so I didn't.

Apparently a user who wants a map has to supply a significant part of what I
consider the implementation of the map. As such, this may serve as a hidden
layer to implement a library of data structures, but seems unusable for the
typical user, for whom using a hashed-map abstraction should be as simple as

function Hash (Key : in Identifier) return Hash_Value;

package Maps is new Lib.Maps
(Identifier => Identifier, Associated_Value => Associated_Value);

I was not willing to spend more than about 15 minutes trying to understand this,
so I may be missing something.

> These packages are mostly implementation details. They are used to build high-level packages similar to the Ada containers

This agrees with what I was saying earlier. But even for such a use, simplicity
and ease of understanding are still the most important aspects of S/W. If
attaining them involves some code duplication they are worth that price.

>> that pkg Keys serves some actual role in the spec of Maps, then someone wanting
>> to use pkg Maps will need to understand that role, which involves understanding
>> Definite_Elements, which involves understanding pkg Traits, which involves
>> understanding Elements.
>
> which involves understanding Ada, which involves understanding the compiler, which involves understanding the kernel sources, ...
> How many times have you checked the whole sources of the GNAT runtime to understand how they implemented the Ada containers ?

One understands a pkg by understanding its spec. I find it hard to believe that
you could actually think that I meant one had to understand the implementation
as well.

--
Jeff Carter
"Apple juice and Darvon is fantastic together."
Play It Again, Sam
127

Re: Calling inherited primitive operations in Ada

<teso01$16gg$1@gioia.aioe.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!wkzB5gFOhLHjvUsb32RKWQ.user.46.165.242.91.POSTED!not-for-mail
From: mailbox@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 13:04:34 +0200
Organization: Aioe.org NNTP Server
Message-ID: <teso01$16gg$1@gioia.aioe.org>
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org>
<e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com>
<teq6r1$262s2$1@dont-email.me> <teq92g$ru9$1@gioia.aioe.org>
<teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com>
<teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com>
<teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com>
<ter8fo$29nsd$1@dont-email.me>
<672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com>
<tesml6$2goms$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="39440"; posting-host="wkzB5gFOhLHjvUsb32RKWQ.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Fri, 2 Sep 2022 11:04 UTC

On 2022-09-02 12:41, Jeffrey R.Carter wrote:

> The only indefinite data structure that is needed seems to be holders.

The language should support and encourage design that does not rely on
memory pools.

In my view one of major advantages of Ada is that indefinite objects can
be handled without resorting to hidden or explicit pointers to pools.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Calling inherited primitive operations in Ada

<bf352372-632c-45c1-b691-758756e87541n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:13ca:b0:343:129:8894 with SMTP id p10-20020a05622a13ca00b0034301298894mr26908117qtk.253.1662117639245;
Fri, 02 Sep 2022 04:20:39 -0700 (PDT)
X-Received: by 2002:a81:7cc3:0:b0:336:e83b:51fd with SMTP id
x186-20020a817cc3000000b00336e83b51fdmr27600700ywc.457.1662117639040; Fri, 02
Sep 2022 04:20:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 2 Sep 2022 04:20:38 -0700 (PDT)
In-Reply-To: <tesneh$2gr8m$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:2863:e1f:40fd:f3da;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:2863:e1f:40fd:f3da
References: <a19c8158-dd9b-46bd-a4aa-113143db642an@googlegroups.com>
<teobs9$dkt$1@gioia.aioe.org> <e731d19b-c4f1-4a47-8dfb-b984588759ccn@googlegroups.com>
<67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <teq6r1$262s2$1@dont-email.me>
<teq92g$ru9$1@gioia.aioe.org> <teqci9$26ntr$1@dont-email.me>
<401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com> <teql47$27jv6$1@dont-email.me>
<12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com> <teqlu3$27mlk$1@dont-email.me>
<dad4c041-142f-4bb3-a51e-d7236996c529n@googlegroups.com> <ter8fo$29nsd$1@dont-email.me>
<b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com> <tesneh$2gr8m$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bf352372-632c-45c1-b691-758756e87541n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Fri, 02 Sep 2022 11:20:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3842
 by: Emmanuel Briot - Fri, 2 Sep 2022 11:20 UTC

> not user friendly. There appears to be extensive HTML documentation, but it can
> only be viewed as HTML source in Github, which is not easy to read, so I didn't.

Those are generated from the .rst files in docs_src/

> typical user, for whom using a hashed-map abstraction should be as simple as
>
> function Hash (Key : in Identifier) return Hash_Value;
> package Maps is new Lib.Maps
> (Identifier => Identifier, Associated_Value => Associated_Value);

Maps are created as

package Maps0 is new GAL.Maps.Def_Def_Unbounded
(Integer,
Element_Type => Integer,
Hash => Test_Support.Hash,
Container_Base_Type => GAL.Controlled_Base);

The only addition here is `Container_Base_Type`, and that's because the library is probable with SPARK, and the latter doesn't support controlled types.
And Ada doesn't support default values for the formal parameters of generics (another annoying limitation !)

> I was not willing to spend more than about 15 minutes trying to understand this,
> so I may be missing something.

Fair enough. The library is really a set of experiments, mostly successful, and I think it might have been used for the implementation of the current
SPARK containers in GNAT, though I am not positive there.
I did look at the pragmARC components, and there you indeed chose to have a large number of similar-looking packages and code duplication. I guess
we'll have just to agree to disagree on the design approach there. But of course, users having choices is what makes an ecosystem interesting.

What I was really going after are graphs and their algorithms. In particular, I want those algorithms to work on any graph data structure provided it has
a number of primitive operations. In fact, the algorithm could also work when the graph is kind of implicit in the code, even if we do not have an actual
Graph object. And those this, you need generics.

A similar approach is what Rust uses all over the place with its traits, or what C++ Boost library uses for its graphs, too.


devel / comp.lang.ada / Calling inherited primitive operations in Ada

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor