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,35782846f963b1e5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.219.170 with SMTP id pp10mr19765856pbc.1.1341798579675; Sun, 08 Jul 2012 18:49:39 -0700 (PDT) Path: l9ni11158pbj.0!nntp.google.com!news2.google.com!postnews.google.com!w21g2000yqw.googlegroups.com!not-for-mail From: Britt Newsgroups: comp.lang.ada Subject: Re: on the need to duplicate code for procedure signature in both body and interface files Date: Sun, 8 Jul 2012 18:48:09 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: NNTP-Posting-Host: 99.37.17.169 Mime-Version: 1.0 X-Trace: posting.google.com 1341798579 32323 127.0.0.1 (9 Jul 2012 01:49:39 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 9 Jul 2012 01:49:39 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: w21g2000yqw.googlegroups.com; posting-host=99.37.17.169; posting-account=rdRzuwoAAAAyW3CSBhs_xgfCUJSc1aNt User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11,gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-07-08T18:48:09-07:00 List-Id: On Jul 7, 7:08=A0pm, "Nasser M. Abbasi" wrote: > Basic question from an Ada newbie. > > One thing that always bothered me in Ada is the need > to physically duplicate the code that represents the API > of the package procedures and functions in both the interface > and the body files (.ads and .adb). > > I do not like duplicating code at all. Even if it is only > for the signature of the API, and even though the Ada > compiler will catch any difference (assuming one changes > the .ads and forget to update the .adb for example). > > Was there no other alternatives to avoid this situation > when Ada was originally designed in order to keep the same > good concept of separating the interface from the body, but > somehow at the same time, eliminate the need to duplicate by > hand the API definition code in 2 separate places? > > I am using GNAT. I Assume this is the same in other Ada > implementations. > > thanks, > --Nasser This topic was recently discussed in the "Ada Programming Language" LinkedIn group in a thread titled "Imaginary proposal for the next Ada standard: Ada compilers will automatically generate Package Specification from Package Body". The discussion started as a poll and most respondents (including me) strongly dislike the idea. Edward Colbert just posted a nice summary there.