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!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Q: discrete_subtype_definition: static only cases? Date: Sun, 7 Jun 2020 15:02:54 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <2d4d6645-7055-4564-a854-6da5fc83af4eo@googlegroups.com> <9c45012c-a4b5-416d-bf1e-c2a8479ec641o@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 7 Jun 2020 13:02:54 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="b243c502e7d88efa94d0bed85751046f"; logging-data="15670"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PjAh55Q7ak5avm8ixgtle1tE1A92s26k=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cancel-Lock: sha1:78UzwSqlWowDzAdBbQpUm4d4nTU= In-Reply-To: <9c45012c-a4b5-416d-bf1e-c2a8479ec641o@googlegroups.com> Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:59003 Date: 2020-06-07T15:02:54+02:00 List-Id: 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