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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a1265d36600e47dd X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.180.105.41 with SMTP id gj9mr793787wib.3.1351616619808; Tue, 30 Oct 2012 10:03:39 -0700 (PDT) Path: q13ni107795wii.0!nntp.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!195.238.0.231.MISMATCH!news.skynet.be!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Static bounds of loop - compilation error Date: Tue, 30 Oct 2012 18:03:38 +0100 Organization: Ada @ Home Message-ID: References: <6cc8e815-96c3-4a79-8bcd-e3aea906b889@googlegroups.com> <36d9f85f-6daa-4b0b-84b9-1a28d24da2b0@googlegroups.com> NNTP-Posting-Host: +zPQpGmOwbI88DEExGuzFQ.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/12.02 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-10-30T18:03:38+01:00 List-Id: Le Tue, 30 Oct 2012 17:10:54 +0100, Adam Beneschan a = =C3=A9crit: > case S(I) is > > or > > case S'(I) is > > should make things work, because now the CASE expression has a nominal= = > subtype S, which is static, rather than "S range X .. Y", which isn't.= > > -- Adam That indeed solve the issue. Note that you can also declare the type at the iteration variable too, a= = good practice, which is even mandatory with SPARK. Unfortunately, doing = = this, ends in a GNAT bug=E2=80=91box: procedure T is type E is (A, B, C); subtype S is E range A .. B; X, Y : S; begin X :=3D A; Y :=3D B; for I : S in X .. Y loop case I is when A =3D> null; when B =3D> null; end case; end loop; end T; -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity