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,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-14 10:10:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!small1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!nntp.giganews.com!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc54.POSTED!not-for-mail Message-ID: <3EEB5701.9010107@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Addding new attributes to Ada0Y References: <1054751321.434656@master.nyc.kbcfp.com> <3ee8901a@andromeda.datanet.hu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc54 1055610647 24.62.164.137 (Sat, 14 Jun 2003 17:10:47 GMT) NNTP-Posting-Date: Sat, 14 Jun 2003 17:10:47 GMT Organization: AT&T Broadband Date: Sat, 14 Jun 2003 17:10:47 GMT Xref: archiver1.google.com comp.lang.ada:39179 Date: 2003-06-14T17:10:47+00:00 List-Id: Vinzent Hoefler wrote: > 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. Is there any convincing explanation why it isn't allowed to > use the actual type of a variable instead of the type itself? No real reason, just no one saw the need for that particular attrbiute. You might want to post a request for the feature in Ada0Y to Ada-Comment@ada-auth.org. > I can imagine situations (especially with subtypes) where it could be > handy to use the variables' type instead of an explicit type > specification. You will need a better justification than that! But there is one. ;-) A discrete variable declaration can have an explict range in its subtype_indication: Size: Integer range 0 .. 1000; There is no way to identify the subtype of Size to use the 'Range attribute, but there are times when it would come in handy. If this is added to the language, then probably the attributes Object'First and Object'Last should also be added for scalar objects. Of course, there is a real useful idiom which would need another language change. Right now the initial value, if it exists, is part of the declaration of an object. Again, no particular reason for that, but RM8.3(14) would need to add another exception to its list. It sure would be nice though, to be able to say: Size: Integer range Some_Expression..Some_Other_Complex_Expression := Size'First;