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=-0.5 required=3.0 tests=BAYES_05,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:a0c:aa55:: with SMTP id e21mr80583194qvb.43.1609857086495; Tue, 05 Jan 2021 06:31:26 -0800 (PST) X-Received: by 2002:a25:dc7:: with SMTP id 190mr113218121ybn.73.1609857086337; Tue, 05 Jan 2021 06:31:26 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 5 Jan 2021 06:31:26 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=20.133.0.13; posting-account=YRfoYAoAAADhSEO2nLYx10QUUvp8akYl NNTP-Posting-Host: 20.133.0.13 References: <1cc09f04-98f2-4ef3-ac84-9a9ca5aa3fd5n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5f0c4c86-bea9-4007-b16e-b4b80749a8b5n@googlegroups.com> Subject: Re: Lower bounds of Strings From: Stephen Davies Injection-Date: Tue, 05 Jan 2021 14:31:26 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:61043 List-Id: On Tuesday, 5 January 2021 at 12:24:52 UTC, Luke A. Guest wrote: > On 05/01/2021 11:04, Stephen Davies wrote: > > > > I'm referring to the fact that any subprogram with a String > > parameter, e.g. Expiration_Date, has to use something like > > Expiration_Date (Expiration_Date'First .. Expiration_Date'First + 1) > > to refer to the first two characters rather than simply saying > > Expiration_Date (1..2). > What if the length changes? By using a constant, say it was 'Last being > used, if that last changes, the program won't crash. > That was simply an example, though it does highlight that you currently cannnot have global constants "Month_First : constant Positive := 1" and "Month_Last : constant Positive := 2". On Tuesday, 5 January 2021 at 11:57:18 UTC, Dmitry A. Kazakov wrote: > > Position-based indices an slices. One could add [] brackets for that > stuff to make C crowd happy. > > S [1] - First array element > S (1) - Array element at index 1 > > Same with slices. Differently to #1, this is would not require excessive > string copying. Yes, I like that idea as a possible alternative solution.