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-7-bit Received: by 10.68.220.230 with SMTP id pz6mr17734147pbc.3.1341720091316; Sat, 07 Jul 2012 21:01:31 -0700 (PDT) Path: l9ni11086pbj.0!nntp.google.com!news2.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: on the need to duplicate code for procedure signature in both body and interface files Date: Sat, 7 Jul 2012 21:01:30 -0700 (PDT) Organization: http://groups.google.com Message-ID: <527261bb-13d1-4ba7-9e03-1992e54a5532@googlegroups.com> References: NNTP-Posting-Host: 69.20.190.126 Mime-Version: 1.0 X-Trace: posting.google.com 1341720091 23955 127.0.0.1 (8 Jul 2012 04:01:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 8 Jul 2012 04:01:31 +0000 (UTC) Cc: nma@12000.org In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-07-07T21:01:30-07:00 List-Id: On Saturday, July 7, 2012 5:08:53 PM UTC-6, Nasser M. Abbasi wrote: > Basic question from an Ada newbie. >=20 > 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). >=20 > 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). >=20 > 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? >=20 > I am using GNAT. I Assume this is the same in other Ada > implementations. >=20 > thanks, > --Nasser There is no real way to do clean separate compilation without something lik= e the spec/body separation (though it may be that everything code-wise is t= he "body" and the "spec" is virtual/internal). My suggestion here is to let the compiler point out your errors. Unlike C/C= ++ an Ada compiler is your friend. There might be an adb -> ads generator l= aying around where you can just feed it an adb file and have it spit out th= e ads-file, but I've never had reason to look for one.