From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Proposal: Auto-allocation of Indefinite Objects Date: Mon, 27 Jul 2020 22:31:34 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <94a54092-a56f-4a99-aaec-08dd611c8fd8@googlegroups.com> <8a502b6c-4609-4cd8-b292-5797fe6421e1n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 27 Jul 2020 20:31:34 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="84aae09eb0512ea0f9ea7734e20ae1cc"; logging-data="22450"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/UDm+uscelLO8ttzptVsk3iAlaSAjD1xQ=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cancel-Lock: sha1:FNd3eA3gvILxgjxm9/su8xHbm6I= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59558 List-Id: On 7/27/20 7:48 PM, Brian Drummond wrote: > > Is there any way we could generalise the (storage, access and lifetime > aspects of) Unbounded_String for unconstrained arrays and discriminated > records in such a way that Unbounded_String can be a simple instantiation > of one of these? Ada.Strings.Unbounded can be considered a combination of Ada.Containers.Indefinite_Holders instantiated for String and Ada.Containers.Vectors instantiated with Positive and Character, with some additional operations added. The To_String and To_Unbounded_String operations of Unbounded_String are similar to the Element and Replace_Element operations of Holder, which do not exist for Vector. The indexed operations of Unbounded_String are similar to the indexed operations of Vector, which do not exist for Holder. If Ada.Containers.Vectors had an additional generic formal type type Fixed is array (Index_Type range <>) of Element_Type; and 2 new operations function To_Fixed (From : Vector) return Fixed; function To_Vector (From : Fixed) return Vector; then we wouldn't need Ada.Strings.Unbounded. -- Jeff Carter "Blessed is just about anyone with a vested interest in the status quo." Monty Python's Life of Brian 73