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,df40d0d1975a16a6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-13 19:01:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-pas-nf2!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3EEA81DC.2080705@spam.com> From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Optimizing Boundary Checks References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 14 Jun 2003 02:01:16 GMT NNTP-Posting-Host: 63.184.16.139 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1055556076 63.184.16.139 (Fri, 13 Jun 2003 19:01:16 PDT) NNTP-Posting-Date: Fri, 13 Jun 2003 19:01:16 PDT Xref: archiver1.google.com comp.lang.ada:39150 Date: 2003-06-14T02:01:16+00:00 List-Id: Vinzent Hoefler wrote [about 'range for array objects]: > > Yes, and finding this *very* useful, it reminds me, I would like to > have this feature for *every* variable, not just for arrays: > > As an example, currently > > |x : My_Enum; > | > |for i in x'Range loop ... > > doesn't work, you have to write > > |for in in My_Enum'Range loop > > each time. Obviously, this doesn't compile; yet another argument against using all lower case for varibles names. Converting it to the probably intended for I in My_Enum'Range loop you still don't have to write this. For loops require a discrete subtype, and a discrete subtype is a discrete subtype, so you simply write for I in My_Enum loop since My_Enum must be a discrete subtype name for My_Enum'range to be legal in a for loop. (Remember that the name in a type declaration is a subtype name.) This doesn't address the question of an attribute to obtain the subtype of an object, which in some cases could be useful, and could reduce errors in some cases when code changes. -- Jeff Carter "Now go away or I shall taunt you a second time." Monty Python & the Holy Grail