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,FREEMAIL_FROM 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.224.185.79 with SMTP id cn15mr2150945qab.4.1363318040561; Thu, 14 Mar 2013 20:27:20 -0700 (PDT) X-Received: by 10.50.242.37 with SMTP id wn5mr33448igc.15.1363318040448; Thu, 14 Mar 2013 20:27:20 -0700 (PDT) Path: k8ni188qas.0!nntp.google.com!dd2no1069633qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 14 Mar 2013 20:27:20 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <87ec4b1d-f7cd-49a4-8cff-d44aeb76a1ad@googlegroups.com> Subject: Re: Is this expected behavior or not From: Shark8 Injection-Date: Fri, 15 Mar 2013 03:27:20 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-03-14T20:27:20-07:00 List-Id: On Thursday, March 14, 2013 4:01:03 PM UTC-6, Randy Brukardt wrote: > "Shark8" wrote in message > news:99929f93-b80f-47c3-8a37-c81002733754@googlegroups.com... > > > > > Would there be a problem using this? > > Generic > > Type T is (<>); > > with function Succ(Input : T) Return T is T'Succ; > > package Test is > > -- Body does whatever is needed requiring Very_Long_Name as T. > > end Test; > > I don't see how this would work. You need to be able to use it on multiple > s in order to make it worth the effort. Er, wouldn't the function Succ be applicable to all Very_Long_Name items inside the package? > > Something like: > > generic > type T is (<>); > procedure Succ (Obj : in out T; Count : in Natural := 1) is -- Note: I > know this requires a separate spec! > begin > for I in 1 .. Count loop > Obj := T'Succ(Obj); > end loop; > end Succ; > > would match the intended attribute semantically. > > > But it doesn't help much, because you have to write the generic somewhere, > and then you have to instantiate it when you need it as well. That's not > very helpful for what is intended to be a short-cut (you usually would end > up typing more). The big advantage of an object attribute (like this 'Succ > or GNAT's 'Img) is that you don't have to figure out the nominal subtype of > the object to increment it once (which you do to write an instance of my > Succ generic). 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?