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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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.219.170 with SMTP id pp10mr18014868pbc.1.1341733139473; Sun, 08 Jul 2012 00:38:59 -0700 (PDT) Path: l9ni11132pbj.0!nntp.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: on the need to duplicate code for procedure signature in both body and interface files References: Date: Sun, 08 Jul 2012 03:38:50 -0400 Message-ID: <85liiuln1x.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (windows-nt) Cancel-Lock: sha1:LCwlYosIbtERnO48cnc2cMdzc94= MIME-Version: 1.0 X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: a77024ff9390ae029e66108707 X-Received-Bytes: 1528 Content-Type: text/plain Date: 2012-07-08T03:38:50-04:00 List-Id: "Nasser M. Abbasi" 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