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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5f5a48f21d7f7525 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!novia!news-out.readnews.com!postnews3.readnews.com!not-for-mail Message-Id: <4c221952$0$2366$4d3efbfe@news.sover.net> From: "Peter C. Chapin" Subject: Re: Inferring array index type from array object Newsgroups: comp.lang.ada Date: Wed, 23 Jun 2010 10:27:46 -0400 References: <6b20ed09-efc1-4df7-90f9-5e141482e8d0@d37g2000yqm.googlegroups.com> <1305oqccr1h2t$.x33x4oxwd84d$.dlg@40tude.net> <88ec2vF3uqU1@mid.individual.net> User-Agent: KNode/0.10.9 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Organization: SoVerNet (sover.net) NNTP-Posting-Host: c6b38a51.news.sover.net X-Trace: DXC=N_==KKl Niklas Holsti wrote: > I don't think such large language changes would be necessary. The > expression S'Range gives the compiler all the information about the type > and its constraints, so I see no reason why Ada could not be extended > simply to allow S'Range in a variable declaration, as in the above > quoted "I : S'Range". The declared variable "I" would have the same > (sub)type as the loop counter in "for I in S'Range loop ...". This seems weird to me. S'Range is a range, not a type. I agree that it includes type information, but then so does an object. X : Integer; Y : X; -- Let Y have the same type as X. Weird. Type inference is a big subject and while it can be very nice in languages that support it comprehensively, type inference doesn't really seem like the "Ada way" to me. In any case, once you start supporting type inference in any form you have to wonder just how far down that road you want to go. Right now Ada only infers types in one very limited case (right?)... that is in support of implicitly declared loop index variables. Peter