comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: on the need to duplicate code for procedure signature in both body and interface files
Date: Sun, 08 Jul 2012 03:38:50 -0400
Date: 2012-07-08T03:38:50-04:00	[thread overview]
Message-ID: <85liiuln1x.fsf@stephe-leake.org> (raw)
In-Reply-To: jtafi8$pvg$1@speranza.aioe.org

"Nasser M. Abbasi" <nma@12000.org> writes:

> I do not like duplicating code at all. 

Why?

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

That covers the main objection I'm aware of; that duplicated code
quickly becomes wrong.

Another objection might be that it takes "too much" time to write the
same code twice. One solution to that is to use a decent IDE (Emacs and
GPS will both copy the spec to the body the first time). Another
solution is to remember that reading is much more important than
writing.

> I am using GNAT. I Assume this is the same in other Ada
> implementations.

Yes, it's in the language standard.

-- 
-- Stephe



  parent reply	other threads:[~2012-07-08  7:38 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
2012-07-13 15:51   ` Robert A Duff
2012-07-08  7:38 ` Stephen Leake [this message]
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