Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"It is easier to port a shell than a shell script." -- Larry Wall


devel / comp.lang.ada / Re: 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
Re: Calling inherited primitive operations in Ada

<tet3ur$2i15a$1@dont-email.me>

  copy mid

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

  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 16:28:43 +0200
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <tet3ur$2i15a$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>
<tesneh$2gr8m$1@dont-email.me>
<bf352372-632c-45c1-b691-758756e87541n@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 14:28:43 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="798f528e301120f327d89dda653e8423";
logging-data="2688170"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18uchVdho1yVvT2UbXTN56+CHO/+Qj7dv0="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:7O9RUgFad5nd+3kChdl9ZypicRM=
In-Reply-To: <bf352372-632c-45c1-b691-758756e87541n@googlegroups.com>
Content-Language: en-US
 by: Jeffrey R.Carter - Fri, 2 Sep 2022 14:28 UTC

On 2022-09-02 13:20, Emmanuel Briot wrote:
>
> 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);

Where is that? All I saw in my quick look were Maps, Maps.Generics, and Maps.Impl.

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

Re: Calling inherited primitive operations in Ada

<teu5gp$2m0pg$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 19:01:28 -0500
Organization: A noiseless patient Spider
Lines: 52
Message-ID: <teu5gp$2m0pg$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>
Injection-Date: Sat, 3 Sep 2022 00:01:29 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="540bec0664a3fed56c5bc4112da1ca1f";
logging-data="2818864"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+FNcVR2jDaAhSrZghh1xBBdcLcHbqwAag="
Cancel-Lock: sha1:r7mg7xlJkTrVBGysy7tnfjwcQsA=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-MSMail-Priority: Normal
X-RFC2646: Format=Flowed; Original
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
 by: Randy Brukardt - Sat, 3 Sep 2022 00:01 UTC

"amo...@unizar.es" <amosteo@unizar.es> wrote in message
news:672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com...
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.

This is premature optimization at it's worst.

> 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 is no penalty in a code sharing implementation like Janus/Ada: the
implementation of definite types is essentially the same as you would write
by hand for an indefinite type. In most cases, all one needs is an
indefinite generic.

(The plan for Janus/Ada was always to use post-compilation optimization to
reduce the overhead of generics, but admittedly, that part never got built.
If I had infinite time...)

Assuming otherwise is certainly premature optimization.

> 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 original expectation for the containers was that there would be many
variants of each container, because the needs for memory management, task
management, and persistence differ between applications: there is no
one-size fits all solution.

But I agree on one point: the "basic" container is unncessary; one should
either use the indefinite or bounded container (depending on your memory
management needs, either fully fixed or fully heap-based) -- stopping in the
middle makes little sense.

Randy.

Re: Calling inherited primitive operations in Ada

<teu5s0$2m1ev$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 19:07:27 -0500
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <teu5s0$2m1ev$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>
Injection-Date: Sat, 3 Sep 2022 00:07:29 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="540bec0664a3fed56c5bc4112da1ca1f";
logging-data="2819551"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18YAudT/xjBJ1wdtWSUvFG5tIeOG52mjYw="
Cancel-Lock: sha1:T2q8SwxsRTX9QjQTfx7sWPJEJMo=
X-Priority: 3
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
 by: Randy Brukardt - Sat, 3 Sep 2022 00:07 UTC

"Emmanuel Briot" <briot.emmanuel@gmail.com> wrote in message
news:b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com...

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

(Wading in where I should probably not tread... :-)

But they violate the #1 principle of the Ada.Containers: ease of use. One
principle that we insisted on was that a single instantiation was the
maximum we would use, because we did not want people moving from arrays to
containers to have to replace one declaration with a half page of magic
incantations. (This is the reason that there is no container interface, for
one consequence, and certainly no signature packages.)

In general, people either undertand and like signature packages, or really
do not understand them and just use them when insisted on. The standard
containers in Ada needed to be usable by the maximum number of users, and
insisting on bells and whistles that many don't understand does not help.

Randy.

Re: Calling inherited primitive operations in Ada

<teu65a$2m29q$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 19:12:25 -0500
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <teu65a$2m29q$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> <tesml6$2goms$1@dont-email.me> <teso01$16gg$1@gioia.aioe.org>
Injection-Date: Sat, 3 Sep 2022 00:12:27 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="540bec0664a3fed56c5bc4112da1ca1f";
logging-data="2820410"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/NDb6BL7vHrRO70yEqhk1/H6HHCNR6uvY="
Cancel-Lock: sha1:S3oiq9/7rfhuCVEm+TuV1tNeGK0=
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MSMail-Priority: Normal
X-RFC2646: Format=Flowed; Response
 by: Randy Brukardt - Sat, 3 Sep 2022 00:12 UTC

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:teso01$16gg$1@gioia.aioe.org...
> 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.

But they're implemented with some sort of hidden allocation. (GNAT uses a
"secondary stack", whatever that is, but that is just a restricted form of
pool). Janus/Ada uses built-in pools with cleanup for all such things to
simplify the interface (the code for allocations and stand-alone objects is
mostly shared, both within the compiler and at runtime).

Randy.

Re: Calling inherited primitive operations in Ada

<teu6d3$2m2r9$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Fri, 2 Sep 2022 19:16:34 -0500
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <teu6d3$2m2r9$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> <tesneh$2gr8m$1@dont-email.me> <bf352372-632c-45c1-b691-758756e87541n@googlegroups.com>
Injection-Date: Sat, 3 Sep 2022 00:16:35 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="540bec0664a3fed56c5bc4112da1ca1f";
logging-data="2820969"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+WfM45jo19p/Xl91Q+H9BIAkgLAm4PyJg="
Cancel-Lock: sha1:wc08Et98+r5BVI3AIoIQ2lW7EJQ=
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-MSMail-Priority: Normal
X-Priority: 3
 by: Randy Brukardt - Sat, 3 Sep 2022 00:16 UTC

"Emmanuel Briot" <briot.emmanuel@gmail.com> wrote in message
news:bf352372-632c-45c1-b691-758756e87541n@googlegroups.com...
....
> And Ada doesn't support default values for the formal parameters of
> generics (another annoying limitation !)

Ada *DOES* support default values for formal parameters of generics. At
least the most used kinds of parameters, including subprograms and types
(the latter added in Ada 2022). Whether GNAT (or your other favorite
compiler) supports formal type defaults yet is a different question.

Randy.

Re: Calling inherited primitive operations in Ada

<tev2t6$1h1e$1@gioia.aioe.org>

  copy mid

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

  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: Sat, 3 Sep 2022 10:23:01 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tev2t6$1h1e$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> <teso01$16gg$1@gioia.aioe.org>
<teu65a$2m29q$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="50222"; 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 - Sat, 3 Sep 2022 08:23 UTC

On 2022-09-03 02:12, Randy Brukardt wrote:
> "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
> news:teso01$16gg$1@gioia.aioe.org...
>> 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.
>
> But they're implemented with some sort of hidden allocation. (GNAT uses a
> "secondary stack", whatever that is, but that is just a restricted form of
> pool). Janus/Ada uses built-in pools with cleanup for all such things to
> simplify the interface (the code for allocations and stand-alone objects is
> mostly shared, both within the compiler and at runtime).

For a programmer that does not matter. The problem with pools is
locking, non-determinism, issues with protected actions. If secondary or
primary stack is the program stack, nobody really cares.

BTW, merely doing pool tracing/bookkeeping becomes a sheer nightmare if
you cannot return a string from a function.

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

Re: Calling inherited primitive operations in Ada

<tev515$2rbj5$1@dont-email.me>

  copy mid

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

  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: Sat, 3 Sep 2022 10:59:16 +0200
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <tev515$2rbj5$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>
<teu5s0$2m1ev$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 3 Sep 2022 08:59:17 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9c86adeae0634fd395773023f8464e8a";
logging-data="2993765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KFScCBz8sXTexVzK262jyUMIfRmSDknM="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:QWFuBx/2PVoQZnYEWcmVmTffUyQ=
Content-Language: en-US
In-Reply-To: <teu5s0$2m1ev$1@dont-email.me>
 by: Jeffrey R.Carter - Sat, 3 Sep 2022 08:59 UTC

On 2022-09-03 02:07, Randy Brukardt wrote:
>
> One
> principle that we insisted on was that a single instantiation was the
> maximum we would use

Except for queues

--
Jeff Carter
"In our experiments, the [Ada] compile[r] was able to find not
just typographical errors, but also conceptual errors in the
development of the code."
Scott and Bagheri
161

Re: Calling inherited primitive operations in Ada

<lysfl8gu6n.fsf@pushface.org>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!Yr2L9qaRshuL+yFKTxsDBA.user.46.165.242.75.POSTED!not-for-mail
From: simon@pushface.org (Simon Wright)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Sat, 03 Sep 2022 20:00:00 +0100
Organization: Aioe.org NNTP Server
Message-ID: <lysfl8gu6n.fsf@pushface.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>
<b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com>
<teu5s0$2m1ev$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="41061"; posting-host="Yr2L9qaRshuL+yFKTxsDBA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (darwin)
Cancel-Lock: sha1:fThay1WlYmnloaSFGSFXxs/wIg4=
X-Notice: Filtered by postfilter v. 0.9.2
 by: Simon Wright - Sat, 3 Sep 2022 19:00 UTC

"Randy Brukardt" <randy@rrsoftware.com> writes:

> But they violate the #1 principle of the Ada.Containers: ease of
> use. One principle that we insisted on was that a single instantiation
> was the maximum we would use

And this was one reason that I didn't put up any arguments at Ada Europe
2002 for the Ada 95 Booch Components to form a basis for Ada.Containers
- you'd need 3 instantiations, one after the other.

-- A company's Fleet holds a number of Cars.

with BC.Containers.Collections.Bounded;
with Cars;
package My_Fleet is

use type Cars.Car;

package Abstract_Car_Containers
is new BC.Containers (Cars.Car);

package Abstract_Car_Collections
is new Abstract_Car_Containers.Collections;

package Fleets
is new Abstract_Car_Collections.Bounded (Maximum_Size => 30);

The_Fleet : Fleets.Collection;

end My_Fleet;

The other was a lack of consistency in the implementation (Length?
Size?).

Re: Calling inherited primitive operations in Ada

<458444ed-e384-4663-896c-bb38dae3c5cbn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:4007:b0:6be:91e8:c94e with SMTP id h7-20020a05620a400700b006be91e8c94emr23630612qko.375.1662361003971;
Sun, 04 Sep 2022 23:56:43 -0700 (PDT)
X-Received: by 2002:a81:6d8b:0:b0:345:1065:7515 with SMTP id
i133-20020a816d8b000000b0034510657515mr7759773ywc.135.1662361003698; Sun, 04
Sep 2022 23:56:43 -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: Sun, 4 Sep 2022 23:56:43 -0700 (PDT)
In-Reply-To: <lysfl8gu6n.fsf@pushface.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e0a:810:89e0:fc7b:9a2c:126e:2e67;
posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 2a01:e0a:810:89e0:fc7b:9a2c:126e:2e67
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> <teu5s0$2m1ev$1@dont-email.me>
<lysfl8gu6n.fsf@pushface.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <458444ed-e384-4663-896c-bb38dae3c5cbn@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: briot.emmanuel@gmail.com (Emmanuel Briot)
Injection-Date: Mon, 05 Sep 2022 06:56:43 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4679
 by: Emmanuel Briot - Mon, 5 Sep 2022 06:56 UTC

Jeff Carter:
> Where is that? All I saw in my quick look were Maps, Maps.Generics, and Maps.Impl.

Simon Wright:
> And this was one reason that I didn't put up any arguments at Ada Europe
> 2002 for the Ada 95 Booch Components to form a basis for Ada.Containers
> - you'd need 3 instantiations, one after the other.

I definitely see the same issue. The way my library is trying to workaround that is as follows:
Those instantiations are only needed for people who want/need to control every aspects of their containers, for instance
how elements are stored, how/when memory is allocated, what is the growth strategy for vectors, and so on.
Most users should not have to care about that in practice. So we use code generation at compile time to generate
high-level packages similar to the Ada containers, with a limited set of formal parameters (in src/generated, to be
more specific). We can generate bounded/unbounded versions, definite/indefinite versions, and any combination of
those.
One of the intentions of the library, initially, had been the implementation of the Ada containers and SPARK containers
in GNAT, as a way to share as much code as possible between the two.

Randy Brukardt:
> Assuming otherwise is certainly premature optimization.

I am quoting a bit out of context, though I believe it is close enough. Designers of containers must care about performance
from the get-go. Otherwise, people might just as well use a list for everything and just traverse the list all the time. We all
know this would be way too inefficient, of course, which is why there are various sorts of containers.
Anyone who has actually written performance-sensitive code knows that memory allocations is definitely something to watch
out for, and the library design should definitely take that into account.

Jeff Carter:
> The only indefinite data structure that is needed seems to be holders

Although it is certainly true that using holders works, it is not applicable when designing a containers library that intends to be
mostly compatible with Ada containers. The latter have chosen, long ago and before Holder was a thing, to have definite and
indefinite versions. The main benefit to this approach is that users still retrieve directly the type they are interested in (e.g. String)
rather than a holder-to-string.
I must admit I have very limited experience with Holders, which I have never used in production code (nor, apparently, have my
colleagues and ex-colleagues).

Randy Brukardt:
> Ada *DOES* support default values for formal parameters of generics

Hey, I just discovered that, thanks Randy ! For people who also did not know that:

generic
type Item_Count is range <> or use Natural;
package Gen is

It is supported by GNAT's newer versions (I don't know when it was implemented though)

Re: Calling inherited primitive operations in Ada

<tf48qe$1pm$1@gioia.aioe.org>

  copy mid

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

  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: Mon, 5 Sep 2022 09:34:37 +0200
Organization: Aioe.org NNTP Server
Message-ID: <tf48qe$1pm$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>
<b678b499-0cb1-4c64-a88f-cfa9a79893e6n@googlegroups.com>
<teu5s0$2m1ev$1@dont-email.me> <lysfl8gu6n.fsf@pushface.org>
<458444ed-e384-4663-896c-bb38dae3c5cbn@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="1846"; 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 - Mon, 5 Sep 2022 07:34 UTC

On 2022-09-05 08:56, Emmanuel Briot wrote:

> Although it is certainly true that using holders works, it is not applicable when designing a containers library that intends to be
> mostly compatible with Ada containers.

Right. Holder requires finalization and finalization means language
prescribed finalization lists which is highly undesirable in many cases.

> The main benefit to this approach is that users still retrieve directly the type they are interested in (e.g. String)
> rather than a holder-to-string.

And that the container designer has control over the pool where the
items get actually allocated.

> I must admit I have very limited experience with Holders, which I have never used in production code (nor, apparently, have my
> colleagues and ex-colleagues).

I have been using the idea for a long time, since Ada 95 before the
standard library had them. In my experience holders multiply the number
of container variants:

1. Definite elements
2. Indefinite elements
+
3. Holder elements in the interface (and maybe implementation)

The third gets a holder package as a formal parameter or, alternatively,
is a child of a holder package (for performance reasons). The container
interface has direct operations in terms of the Element_Type as well as
in terms of the holder type.

Sometimes the holder variant is actually the indefinite one that
promotes holders only in its interface.

P.S. In my opinion helper types/package is an evil of far greater scale
than any premature optimization!

The programmers doing the latter at least try to understand the code
they write.

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

Re: Calling inherited primitive operations in Ada

<6d7f82cf-a52a-4fbe-b9f7-f06e55e76429n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:a843:0:b0:6c3:3902:a346 with SMTP id r64-20020a37a843000000b006c33902a346mr9097676qke.538.1662367999916;
Mon, 05 Sep 2022 01:53:19 -0700 (PDT)
X-Received: by 2002:a81:a108:0:b0:345:1ba8:638f with SMTP id
y8-20020a81a108000000b003451ba8638fmr6450719ywg.422.1662367999667; Mon, 05
Sep 2022 01:53:19 -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: Mon, 5 Sep 2022 01:53:19 -0700 (PDT)
In-Reply-To: <teu5gp$2m0pg$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>
<672e9bc6-1e53-42cb-a339-9230ab949de9n@googlegroups.com> <teu5gp$2m0pg$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6d7f82cf-a52a-4fbe-b9f7-f06e55e76429n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: amosteo@unizar.es (amo...@unizar.es)
Injection-Date: Mon, 05 Sep 2022 08:53:19 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 4559
 by: amo...@unizar.es - Mon, 5 Sep 2022 08:53 UTC

On Saturday, September 3, 2022 at 2:01:32 AM UTC+2, Randy Brukardt wrote:
> "amo...@unizar.es" <amo...@unizar.es> wrote in message
> news:672e9bc6-1e53-42cb...@googlegroups.com...
> 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.

> This is premature optimization at it's worst.

Just because the language doesn't offer a way to do it. Otherwise I wouldn't need to care.

> > 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 is no penalty in a code sharing implementation like Janus/Ada: the
> implementation of definite types is essentially the same as you would write
> by hand for an indefinite type. In most cases, all one needs is an
> indefinite generic.

Well, that sounds neat for Janus/Ada, but is a different issue to clients having to wrap their indefinite types prior to instantiation, and suffer the unwrapping throughout the code.

> (The plan for Janus/Ada was always to use post-compilation optimization to
> reduce the overhead of generics, but admittedly, that part never got built.
> If I had infinite time...)
>
> Assuming otherwise is certainly premature optimization.

I'm of the opinion that it goes beyond just premature optimization, in the terrain of readability/maintainability by causing boilerplate, and when generics specializations do become necessary, by causing code duplication.

> > 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 original expectation for the containers was that there would be many
> variants of each container, because the needs for memory management, task
> management, and persistence differ between applications: there is no
> one-size fits all solution.
>
> But I agree on one point: the "basic" container is unncessary; one should
> either use the indefinite or bounded container (depending on your memory
> management needs, either fully fixed or fully heap-based) -- stopping in the
> middle makes little sense.

That makes sense, right.

>
> Randy.

Re: Calling inherited primitive operations in Ada

<7f1d9214-f562-46a0-a0d9-886a5bbbbf16n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:5fd6:0:b0:343:4b4:1022 with SMTP id k22-20020ac85fd6000000b0034304b41022mr38849919qta.616.1662368201037;
Mon, 05 Sep 2022 01:56:41 -0700 (PDT)
X-Received: by 2002:a25:b74b:0:b0:69c:7a73:93ec with SMTP id
e11-20020a25b74b000000b0069c7a7393ecmr21160277ybm.67.1662368200785; Mon, 05
Sep 2022 01:56:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Mon, 5 Sep 2022 01:56:40 -0700 (PDT)
In-Reply-To: <6d7f82cf-a52a-4fbe-b9f7-f06e55e76429n@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>
<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> <teu5gp$2m0pg$1@dont-email.me>
<6d7f82cf-a52a-4fbe-b9f7-f06e55e76429n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7f1d9214-f562-46a0-a0d9-886a5bbbbf16n@googlegroups.com>
Subject: Re: Calling inherited primitive operations in Ada
From: amosteo@unizar.es (amo...@unizar.es)
Injection-Date: Mon, 05 Sep 2022 08:56:41 +0000
Content-Type: text/plain; charset="UTF-8"
 by: amo...@unizar.es - Mon, 5 Sep 2022 08:56 UTC

On Monday, September 5, 2022 at 10:53:21 AM UTC+2, amo...@unizar.es wrote:
> On Saturday, September 3, 2022 at 2:01:32 AM UTC+2, Randy Brukardt wrote:

> Well, that sounds neat for Janus/Ada, but is a different issue to clients having to wrap their indefinite types prior to instantiation, and suffer the unwrapping throughout the code.

Drats, I was here obviously thinking about the contrary case where only the definite container exists...

Re: Calling inherited primitive operations in Ada

<tf4fkg$3hmgk$1@dont-email.me>

  copy mid

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

  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: Mon, 5 Sep 2022 11:30:56 +0200
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <tf4fkg$3hmgk$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>
<teu5s0$2m1ev$1@dont-email.me> <lysfl8gu6n.fsf@pushface.org>
<458444ed-e384-4663-896c-bb38dae3c5cbn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 5 Sep 2022 09:30:56 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="084353e355218e05b3998b0051d16657";
logging-data="3725844"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Z2TFDlKt7anDuRudrF4+PKxofdZNVrfI="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.11.0
Cancel-Lock: sha1:nuVX6KNxq3VkdgZc8bLniHPq1HA=
Content-Language: en-US
In-Reply-To: <458444ed-e384-4663-896c-bb38dae3c5cbn@googlegroups.com>
 by: Jeffrey R.Carter - Mon, 5 Sep 2022 09:30 UTC

On 2022-09-05 08:56, Emmanuel Briot wrote:
>
> I definitely see the same issue. The way my library is trying to workaround that is as follows:
> Those instantiations are only needed for people who want/need to control every aspects of their containers, for instance
> how elements are stored, how/when memory is allocated, what is the growth strategy for vectors, and so on.
> Most users should not have to care about that in practice. So we use code generation at compile time to generate
> high-level packages similar to the Ada containers, with a limited set of formal parameters (in src/generated, to be
> more specific). We can generate bounded/unbounded versions, definite/indefinite versions, and any combination of
> those.

This seems backwards. The user should encounter the forms most likely to be used
first; if part of the packages are in a subdirectory, those should be the ones
less likely for the typical user to use.

> Although it is certainly true that using holders works, it is not applicable when designing a containers library that intends to be
> mostly compatible with Ada containers. The latter have chosen, long ago and before Holder was a thing, to have definite and
> indefinite versions. The main benefit to this approach is that users still retrieve directly the type they are interested in (e.g. String)
> rather than a holder-to-string.

Before Ada.Containers existed, I commonly used definite data structures from the
PragmARCs with Unbounded_String, which is partly a specialized holder for String
(and partly a specialized Vector for Positive/Character). Generalizing from this
led to implementing a Holder pkg.

When I said a holder is the only indefinite pkg that is needed, I meant to imply
that other indefinite structures would be implemented using the definite form +
holder.

--
Jeff Carter
“Bug rates in C++ are running higher even than C ...”
Stephen F. Zeigler
216

Re: Calling inherited primitive operations in Ada

<tf8pei$1mfc$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Tue, 6 Sep 2022 19:42:57 -0500
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <tf8pei$1mfc$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> <teu5s0$2m1ev$1@dont-email.me> <tev515$2rbj5$1@dont-email.me>
Injection-Date: Wed, 7 Sep 2022 00:42:59 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="1e5353e773e7c4e82af0f578383063bb";
logging-data="55788"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+jXxWAWH4D5+60XYv5hEitx2d9L33lvsw="
Cancel-Lock: sha1:0xS94zZqOyjunVjgPL2f3eJ58tk=
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-Priority: 3
X-MSMail-Priority: Normal
X-RFC2646: Format=Flowed; Response
 by: Randy Brukardt - Wed, 7 Sep 2022 00:42 UTC

"Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not> wrote in message
news:tev515$2rbj5$1@dont-email.me...
> On 2022-09-03 02:07, Randy Brukardt wrote:
>>
>> One
>> principle that we insisted on was that a single instantiation was the
>> maximum we would use
>
> Except for queues

Right, and one consequence of that is that the queues aren't used much. (Not
sure if they would be used much in any case, they're definitely a
specialized need compared to a map.)

Randy.

Re: Calling inherited primitive operations in Ada

<tf8pv1$1nld$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: randy@rrsoftware.com (Randy Brukardt)
Newsgroups: comp.lang.ada
Subject: Re: Calling inherited primitive operations in Ada
Date: Tue, 6 Sep 2022 19:51:44 -0500
Organization: A noiseless patient Spider
Lines: 37
Message-ID: <tf8pv1$1nld$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> <teu5s0$2m1ev$1@dont-email.me> <lysfl8gu6n.fsf@pushface.org> <458444ed-e384-4663-896c-bb38dae3c5cbn@googlegroups.com>
Injection-Date: Wed, 7 Sep 2022 00:51:45 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="1e5353e773e7c4e82af0f578383063bb";
logging-data="57005"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gIjTl0/jgJEniYQAnJ9NX+B06Rfr9RtE="
Cancel-Lock: sha1:0MnMKTBaRpaLK5YJpT8vF9BTgiY=
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-Priority: 3
X-RFC2646: Format=Flowed; Original
 by: Randy Brukardt - Wed, 7 Sep 2022 00:51 UTC

"Emmanuel Briot" <briot.emmanuel@gmail.com> wrote in message
news:458444ed-e384-4663-896c-bb38dae3c5cbn@googlegroups.com...
....
> Randy Brukardt:
>> Assuming otherwise is certainly premature optimization.
>
> I am quoting a bit out of context, though I believe it is close enough.
> Designers of containers must care about performance
> from the get-go. Otherwise, people might just as well use a list for
> everything and just traverse the list all the time. We all
> know this would be way too inefficient, of course, which is why there
> are various sorts of containers. Anyone who has actually written
> performance-sensitive code knows that memory allocations is definitely
> something to watch out for, and the library design should definitely take
> that into account.

Definitely out of context. If you have code which is truly performance
sensitive, then it cannot also be portable Ada code. That's because of the
wide variety of implementation techniques, especially for generics. (For
Janus/Ada, if you have critical performance needs, you have to avoid the use
of generics in those critical paths -- sharing overhead is non-zero.)

I agree that the design of the containers matters (which is why the we made
the sets of operations for the various containers as close as possible, so
switching containers is relatively easy). But the indefinite/definite thing
is premature optimization - it makes little difference for a Janus/Ada
generic, at least in the absence of the full-program optimizer (that we
never built). If your code isn't intended to be portable Ada code, then
*maybe* it makes sense to worry about such things. But the expectation was
always that containers would be useful in cases where the performance is
*not* critical - one probably should use a custom data structure for
performance critical things. (But most things aren't really performance
critical in reality.)

Randy.


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

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor