From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Community Input for the Maintenance and Revision of the Ada Programming Language Date: Tue, 12 Sep 2017 14:09:50 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <915874b5-52c0-4aa8-9023-82fddedb816f@googlegroups.com> <67345f73-530c-400b-9eb4-63eeb440154c@googlegroups.com> <9a6338d9-83be-4e45-b8b7-edc56e33537f@googlegroups.com> <2deb28e2-f7e8-4461-b8b8-c2c6cf2784aa@googlegroups.com> NNTP-Posting-Host: vZYCW951TbFitc4GdEwQJg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 X-Notice: Filtered by postfilter v. 0.8.2 Content-Language: en-US Xref: news.eternal-september.org comp.lang.ada:48050 Date: 2017-09-12T14:09:50+02:00 List-Id: On 12/09/2017 12:48, Egil H H wrote: > On Tuesday, September 12, 2017 at 12:22:12 PM UTC+2, Dmitry A. Kazakov wrote: >> >> Yes, but they would be different. A more close example would be: >> >> type Bounded_String (Bound : Natural := Max) is record >> Length : Natural := 0; >> Text : String (1..Bound); >> end record; > > Well, I don't have unlimited memory, so allocating Natural'Last > number of Characters for all my strings is not an option for me, but > I guess YMMV. > > (Sure, you can use a subtype other than Natural, but how do you > choose an upper bound that is both reasonably large to fit most > needs, yet reasonably small to limit memory usage?) The same way I supposed to choose it for Ada.Strings.Bounded? As I said there is almost no use for bounded-length strings. It is much easier to create new local fixed-length strings all the time. String re-assignment must ring alarm bells no sane algorithm should require this. The only one case where Unbounded_String has a use is when returning multiple strings out of a procedure. If ad-hoc tuples were supported that won't be necessary either. Though it possible to create a result record like: type Result (L1, L2, L3 : Natural) is record S1 : String (1..L1); S2 : String (1..L2); S3 : String (1..L3); end record; and I frequently do this, it does not look elegant. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de