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!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: Sun, 3 Sep 2017 14:59:35 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <4dc188de-802b-41ad-9cdd-b8246eb9a1c7@googlegroups.com> <47cc6474-8b75-4644-92d0-bd1f694c20e7@googlegroups.com> <338b355a-dee4-4c73-b00e-09d9a8430fb1@googlegroups.com> NNTP-Posting-Host: MajGvm9MbNtGBKE7r8NgYA.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; 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:47913 Date: 2017-09-03T14:59:35+02:00 List-Id: On 2017-09-03 12:32, Alejandro R. Mosteo wrote: > And is there a difference to using rename?: Yes, because renaming does not touch bounds even if explicitly required by the subtype. It is clear why renaming to a subtype does not slide bounds. That is because Ada treat a subtype as a constraint. For the same reason it is not illegal have such a renaming, that appears to the reading as bound sliding. What was a language design bug that the new constraint is not enforced. The program should raise Constraint_Error when the index is outside the new bounds, even if wihin the original bounds. Surely that would be useless behavior, but that is what follows from the Ada's subtype definition. One cannot have both. > (I was actually surprised that you can't explicitly write > Zero_Array(Item) with renames). I am in favor of changing subtypes to be more flexible with the representation. An alternative would be allowing renaming to another type: type Array_Type is array (Integer range <>) of Float; procedure Foo (A : Array_Type) is type Zero_Array is array (Unsigned range <>) of Float; B : Zero_Array renames A; -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de