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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f0b19a44b99ada68,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-25 13:54:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!proxad.net!wanadoo.fr!not-for-mail From: Guillaume Foliard Newsgroups: comp.lang.ada Subject: Type inference in loops with immediate constants Date: Wed, 25 Jun 2003 22:54:02 +0200 Organization: Old Europe Message-ID: NNTP-Posting-Host: aboulogne-102-1-3-24.w193-253.abo.wanadoo.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news-reader1.wanadoo.fr 1056574443 6751 193.253.180.24 (25 Jun 2003 20:54:03 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 25 Jun 2003 20:54:03 GMT User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.lang.ada:39741 Date: 2003-06-25T20:54:03+00:00 List-Id: Hi, I'm currently chasing down a Constraint_Error exception and while I was reading one loop statement I wondered about the type inference in such a place. Here is the snippet : --- Length : Positive; -- reminder : subtype Integer range 1 .. Integer'Last for Index in 0 .. Length - 1 loop --- Then what type Index should be ? Positive ? Obviously not, because of the 0, which is not a Positive, as a starting value. Integer ? Is the compiler using the fact that a positive is derived from an universal integer and thus decides to give the base type to the loop variable ? -- Guillaume