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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2a34b7ad6c6a0774 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!l6g2000yqb.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Tue, 10 Aug 2010 07:28:27 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <8349c981-4dca-49dc-9189-8ea726234de3@f42g2000yqn.googlegroups.com> NNTP-Posting-Host: 174.28.232.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1281450510 18885 127.0.0.1 (10 Aug 2010 14:28:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 10 Aug 2010 14:28:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l6g2000yqb.googlegroups.com; posting-host=174.28.232.29; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729; .NET CLR 4.0.20506),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13067 Date: 2010-08-10T07:28:27-07:00 List-Id: On Aug 10, 7:52 am, Elias Salom=E3o Helou Neto wrote: > > function Generic_Elliptic_Integral (X : Real; K : Real) return Real is > > type Internal is digits Real'Digits * 2; -- You cannot do that! > > begin > > ... > > I don't fully understand the code, but it does seem to be very > intuitive. What does > > type Real is digits <>; > > mean? Is "digits" a keyword of the language? I guess Ada groups > fundamental types in categories and "digits" mean we must use some > floating point type as the template argument, right? It sounds like a > good idea, specially if things like that could be done for user > defined types, i.e., if I can define my own type that "is digits <>". > > > -- > > Regards, > > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de > > "Digits" is a keyword in the language, in particular it is used to define the number of digits-of-precision in a floating-point type. The <> in this case is telling the compiler that the type 'Real', which is the name some floating-point type will be referred to in the generic; the purpose is to allow the programmer the ability to write code that is independent of the precision but dependent on the [properties of the] class of type.