From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-3.2 required=3.0 tests=BAYES_00,NICE_REPLY_A, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "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 Message-ID: References: <67b32db0-c4db-466c-ac13-e597e008c762n@googlegroups.com> <401d6f59-2c28-4dd5-9fa6-fccf33b6d645n@googlegroups.com> <12cc33b1-2c39-4057-8a03-623064b06e8en@googlegroups.com> <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> Xref: reader01.eternal-september.org comp.lang.ada:64292 List-Id: 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