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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,UTF8 X-Google-Thread: 103376,df40d0d1975a16a6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-14 01:31:54 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!fu-berlin.de!uni-berlin.de!dialin-145-254-040-130.arcor-ip.NET!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Optimizing Boundary Checks Date: Sat, 14 Jun 2003 10:34:34 +0200 Organization: At home Message-ID: References: Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-040-130.arcor-ip.net (145.254.40.130) Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit X-Trace: fu-berlin.de 1055579510 18719677 145.254.40.130 (16 [77047]) User-Agent: KNode/0.7.1 Xref: archiver1.google.com comp.lang.ada:39156 Date: 2003-06-14T10:34:34+02:00 List-Id: Vinzent Hoefler wrote: > 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. Is there any convincing explanation why it isn't allowed to > use the actual type of a variable instead of the type itself? I can > imagine situations (especially with subtypes) where it could be handy > to use the variables' type instead of an explicit type specification. Another example where getting the actual type could be useful: procedure Foo (X, Y : Object'Class) is begin if X in Y'Class then -- Illegal ín Ada ... [However the same effect could be achieved if Tag were comparable.] declare Z : Y'Class; -- Steals discriminants and the tag -- of possibly limited Y -- Regards, Dmitry A. Kazakov www.dmitry-kazakov.de