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=-1.9 required=3.0 tests=BAYES_00,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader01.eternal-september.org!aioe.org!wkzB5gFOhLHjvUsb32RKWQ.user.46.165.242.91.POSTED!not-for-mail From: "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: 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: 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 Xref: reader01.eternal-september.org comp.lang.ada:64287 List-Id: 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