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.175.65 with SMTP id w1mr444621qaz.7.1363214922333; Wed, 13 Mar 2013 15:48:42 -0700 (PDT) X-Received: by 10.50.93.33 with SMTP id cr1mr19938igb.5.1363214922271; Wed, 13 Mar 2013 15:48:42 -0700 (PDT) Path: k8ni143qas.0!nntp.google.com!dd2no317154qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 13 Mar 2013 15:48:41 -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> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <99929f93-b80f-47c3-8a37-c81002733754@googlegroups.com> Subject: Re: Is this expected behavior or not From: Shark8 Injection-Date: Wed, 13 Mar 2013 22:48:42 +0000 Content-Type: text/plain; charset=ISO-8859-1 Date: 2013-03-13T15:48:41-07:00 List-Id: On Wednesday, March 13, 2013 3:09:24 PM UTC-6, Randy Brukardt wrote: > "Dmitry A. Kazakov" wrote in message > > news:11rcs3gg4taww$.bylek8fsshyz$.dlg@40tude.net... > > > On Wed, 13 Mar 2013 17:45:56 +0000, Simon Wright wrote: > > > >> I don't remember ever using 'Pred/'Succ, > > > > Even in: > > generic > > type Discrete is (<>); > > package Foo is > > ? > > I'm not Simon, but in generics I've only used loops on discrete types (the > usual reason for such a type being to index an array). In almost all other > cases, I've ended up taking 'Pos on them because real math was needed > (masking, usually). > > The not-defined procedure 'Succ would have been much more useful because it > could replace expressions like: > > := + 1; > with > 'Succ; > > which would eliminate the potential for errors, possibly generate better > code (by not having to evaluate twice if it contains > function calls), and eliminate the hair-brained calls for ":=+" operators > (which don't even work for Ada). > 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;