comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Q: discrete_subtype_definition: static only cases?
Date: Sun, 7 Jun 2020 15:02:54 +0200
Date: 2020-06-07T15:02:54+02:00	[thread overview]
Message-ID: <rbiohu$f9m$2@dont-email.me> (raw)
In-Reply-To: <9c45012c-a4b5-416d-bf1e-c2a8479ec641o@googlegroups.com>

On 6/7/20 2:13 PM, gautier_niouzes@hotmail.com wrote:
>> No. The basic principle is that types are static (they determine the
>> underlying representation) and subtypes are dynamic.
> 
> Well, there are obviously exceptions to that basic principle:
> 
> procedure SD2 is
> begin
>    for I in 1 .. 3 loop
>      declare
>        type T is array (1 .. I) of Integer;  --  I is a variable
>        B: T;
>      begin
>        null;
>      end;
>    end loop;
> end;

Conceptually, this declaration is equivalent to

type /anon/ is array (Integer range <>) of Integer;
subtype T is /anon/ (1 .. I);

So the (anonymous) type is static, but the (first-named) subtype is not.

-- 
Jeff Carter
"How'd you like to hide the egg and gurgitate
a few saucers of mocha java?"
Never Give a Sucker an Even Break
101

  reply	other threads:[~2020-06-07 13:02 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
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 [this message]
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