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!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Q: discrete_subtype_definition: static only cases? Date: Sun, 7 Jun 2020 15:05:24 +0300 Organization: Tidorum Ltd Message-ID: References: <2d4d6645-7055-4564-a854-6da5fc83af4eo@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net 6gxr75lHPf4gTvWmCWL27wJIBxpVKRxbZNFIMy3cp2qahjohxU Cancel-Lock: sha1:X1uET/8EdeXVwt7uYswHkG16/xY= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59000 Date: 2020-06-07T15:05:24+03:00 List-Id: On 2020-06-07 14:36, Niklas Holsti wrote: > On 2020-06-07 13:40, J-P. Rosen wrote: >> Le 07/06/2020 à 11:27, gautier_niouzes@hotmail.com a écrit : >>> Are there cases in the Ada syntax where a discrete_subtype_definition >>> (RM 3.6 (6)) is expected to be determined at compile-time? >>> >>> For instance, for array indices or "for" loops, it can be static or >>> dynamic. >>> Same for subtypes. >> >> No. The basic principle is that types are static (they determine the >> underlying representation) and subtypes are dynamic. > > Subtype indications in case statements and record type declarations with > variant parts must be static. > > But AFAIK subtypes used as array indices are never required to be static. However, RM 4.9.1 defines when two ranges statically match, and refers to the use that concept in RM 12.5.3, Formal Array Types. This may be a case where some index subtypes should be static for things to work as the programmer wants. -- Niklas Holsti niklas holsti tidorum fi . @ .