comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Q: discrete_subtype_definition: static only cases?
Date: Sun, 7 Jun 2020 15:05:24 +0300
Date: 2020-06-07T15:05:24+03:00	[thread overview]
Message-ID: <hk43g4Fq7rfU1@mid.individual.net> (raw)
In-Reply-To: <hk41pvFpuqaU1@mid.individual.net>

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
       .      @       .

  reply	other threads:[~2020-06-07 12:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07  9:27 Q: discrete_subtype_definition: static only cases? gautier_niouzes
2020-06-07 10:40 ` J-P. Rosen
2020-06-07 11:36   ` Niklas Holsti
2020-06-07 12:05     ` Niklas Holsti [this message]
2020-06-07 21:02     ` J-P. Rosen
2020-06-08  4:55       ` gautier_niouzes
2020-06-07 12:13   ` gautier_niouzes
2020-06-07 13:02     ` Jeffrey R. Carter
2020-06-07 13:14       ` gautier_niouzes
2020-06-07 13:50         ` AdaMagica
2020-06-07 14:11           ` gautier_niouzes
2020-06-07 13:00 ` Jeffrey R. Carter
2020-06-11  5:36 ` reinert
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox