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-Thread: a07f3367d7,73cb216d191f0fef X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.106.73 with SMTP id gs9mr1106707wib.2.1363381565445; Fri, 15 Mar 2013 14:06:05 -0700 (PDT) MIME-Version: 1.0 X-FeedAbuse: http://nntpfeed.proxad.net/abuse.pl feeded by 88.191.116.97 Path: g1ni68005wig.0!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!nntpfeed.proxad.net!dedibox.gegeweb.org!gegeweb.eu!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Is this expected behavior or not Date: Fri, 15 Mar 2013 16:05:59 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <8klywqh2pf$.1f949flc1xeia.dlg@40tude.net> <513f6e2f$0$6572$9b4e6d93@newsspool3.arcor-online.net> <513faaf7$0$6626$9b4e6d93@newsspool2.arcor-online.net> <51408e81$0$6577$9b4e6d93@newsspool3.arcor-online.net> <11rcs3gg4taww$.bylek8fsshyz$.dlg@40tude.net> <99929f93-b80f-47c3-8a37-c81002733754@googlegroups.com> <87ec4b1d-f7cd-49a4-8cff-d44aeb76a1ad@googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1363381563 1720 69.95.181.76 (15 Mar 2013 21:06:03 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 15 Mar 2013 21:06:03 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Date: 2013-03-15T16:05:59-05:00 List-Id: "Shark8" wrote in message news:87ec4b1d-f7cd-49a4-8cff-d44aeb76a1ad@googlegroups.com... ... > Hm, true; speaking of object-attributes I sometimes [though not too often] > wish I could write something like: > Procedure X( Input : Some_Type ) is > Temp : Input'Type := Some_Value; > begin > -- Whatever needs done. > end X; > > Is there any reason that should be disallowed / would be difficult for > compiler-writers to implement? I've occassionally had such a thought, too. Probably the reason this doesn't exist is that Ada 83 didn't have type-valued attributes and thus it wasn't considered there. ('Base could only be used as an attribute prefix in Ada 83). There would potentially be a cost to an object attribute vs. using the subtype name directly, in that the prefix would have to be evaluated (which, if it included function calls or checks, would generate some code). I suppose there might be a problem in that this would provide a way to give a name to anonymous types. Most of the Ada rules presume that such types can't be named and thus can't be used in contexts where a name is required (like explicit type conversions). So there might be some problems raised by that; probably not insurmountable but makes it harder than trivial (in which case all of the trade-offs have to be considered - and given that the new capability here is either low or not desired - depending on your point of view - that makes it unlikely). What I'm talking about is something like: procedure P (A : access Int) is Obj : A'Type; -- A second object of a single anonymous type, not possible now. begin Obj := A'Type(Some_Ptr); -- An explicit conversion to an anonymous access type, not possible now. end P; It's not clear that there is any problem here, it's just that we haven't considered it and usually that means there is a problem there. :-) Could just be FUD, too. Randy.