comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam.jrcarter.not@spam.not.acm.org>
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
Date: 2012-07-07T23:09:52-07:00	[thread overview]
Message-ID: <jtb87i$2io5$1@adenine.netfront.net> (raw)
In-Reply-To: <jtafi8$pvg$1@speranza.aioe.org>

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 ---



  parent reply	other threads:[~2012-07-08  6:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-07 23:08 on the need to duplicate code for procedure signature in both body and interface files Nasser M. Abbasi
2012-07-08  4:01 ` Shark8
2012-07-08 17:13   ` Brian Drummond
2012-07-08  4:21 ` Niklas Holsti
2012-07-08  6:09 ` Jeffrey Carter [this message]
2012-07-13 15:51   ` Robert A Duff
2012-07-08  7:38 ` Stephen Leake
2012-07-08 10:52 ` Manuel Collado
2012-07-09  1:48 ` Britt
2012-07-09 10:49   ` AdaMagica
2012-07-09 15:11 ` Adam Beneschan
2012-07-13 17:12 ` björn lundin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox