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!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Lower bounds of Strings Date: Fri, 15 Jan 2021 16:12:37 +0100 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <1cc09f04-98f2-4ef3-ac84-9a9ca5aa3fd5n@googlegroups.com> <5a249a9a-0b16-431d-8530-3962b25b6498n@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 15 Jan 2021 15:12:37 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="9f2bc03ee3c2b45f6cd1a24de01dbbc6"; logging-data="31536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18HkulAiy3KltmZVfA5aZAQjQUBM1qc6ME=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 Cancel-Lock: sha1:Me14iur8hqF5dgg86SFHkDHj13g= In-Reply-To: <5a249a9a-0b16-431d-8530-3962b25b6498n@googlegroups.com> Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:61143 List-Id: On 1/15/21 2:56 PM, Stephen Davies wrote: > On Friday, 15 January 2021 at 11:48:27 UTC, Jeffrey R. Carter wrote: >> type String_Base is array (Positive range <>) of Character; >> subtype String is String_Base (Positive range 1 .. <>); > > I wish it had been this way since the beginning. That way, in those > rare instances where code is really using the variable lower-bound, > the use of String_Base would the intention clear. Alas, making that > change now would break that code. We have that now, with the substitutions String_Base => String String => type S1 (Length : Natural is record Value : String (1 .. Length); end record; or subtype S1 is String with Dynamic_Predicate => S1'First = 1; -- Jeff Carter "[I]t is more important to make the purpose of the code unmistakable than to display virtuosity. Even storage requirements and execution time are unimportant by comparison ..." Elements of Programming Style 184