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!aioe.org!5WHqCw2XxjHb2npjM9GYbw.user.gioia.aioe.org.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Lower bounds of Strings Date: Wed, 13 Jan 2021 14:53:26 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <1cc09f04-98f2-4ef3-ac84-9a9ca5aa3fd5n@googlegroups.com> <37ada5ff-eee7-4082-ad20-3bd65b5a2778n@googlegroups.com> <26cac901-b901-4c4f-aba9-eab6cbd2a525n@googlegroups.com> <50f68100-8909-4fdb-ad26-14bcbc010775n@googlegroups.com> <51b90b8a-a0f4-4a36-8eef-015eee8abdadn@googlegroups.com> NNTP-Posting-Host: 5WHqCw2XxjHb2npjM9GYbw.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 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader02.eternal-september.org comp.lang.ada:61116 List-Id: On 2021-01-13 14:27, AdaMagica wrote: > Dmitry A. Kazakov schrieb am Mittwoch, 13. Januar 2021 um 13:00:19 UTC+1: >> Nothing prevents implementation from using one of the bounds and the >> length in the array's dope vector. It is a question of optimization. > > type UC is array (Integer range <>) of Something; > procedure Proc (X: UC); > > Here, no sliding is allowed in a call to Proc. > And, as Randy said before, X: UC (+1234..-1234); must return the correct values for 'First and 'Last. I am not sure that the invariant (I1..I2 => 0)'Last = I2 must be true while I1 + (I1..I2 => 0)'Length - 1 = I2 False. Yes, it is kind of broken. One of them does not hold. If we wanted to fix it we should respect mathematics where intervals of negative length are not empty intervals. So (0..-100 => 0)'Length = -99 or else Constraint_Error in the aggregate. [And yes, that would break a lot of sloppy legacy code if we attempted to fix it] > So an optimization would need three values, First, Last, Length. Why not? Possibly. However, I see little problem with indices of null arrays. Semantically an index in the null array is meaningless and could be any [or none], because the whole idea of an index to point to an element. No elements, nothing to point to. Logically, Null_Array'Last should be Constraint_Error. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de