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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA 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 pz6mr17918104pbc.3.1341727796660; Sat, 07 Jul 2012 23:09:56 -0700 (PDT) Path: l9ni11132pbj.0!nntp.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!novia!news.glorb.com!news.netfront.net!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: on the need to duplicate code for procedure signature in both body and interface files Date: Sat, 07 Jul 2012 23:09:52 -0700 Organization: Also freenews.netfront.net; news.tornevall.net Message-ID: References: NNTP-Posting-Host: 184.20.13.59 Mime-Version: 1.0 X-Trace: adenine.netfront.net 1341727796 84741 184.20.13.59 (8 Jul 2012 06:09:56 GMT) X-Complaints-To: news@netfront.net NNTP-Posting-Date: Sun, 8 Jul 2012 06:09:56 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-07-07T23:09:52-07:00 List-Id: On 07/07/2012 04:08 PM, 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). Consider the following: package P is function F (I : Integer) return Integer; type Integer_List is array (Integer range <>) of Integer; function F return Integer_List; end P; How are you going to write the body of P so the compiler knows which body implements which function F without repeating the parameter list and return type profile, which is what distinguishes these 2 overloaded functions? -- Jeff Carter "This school was here before you came, and it'll be here before you go." Horse Feathers 48 --- Posted via news://freenews.netfront.net/ - Complaints to news@netfront.net ---