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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d927b7ea9b65580a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-09 08:29:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.wirehub.nl!news-hub.cableinet.net!blueyonder!newspeer1-gui.server.ntli.net!ntli.net!news13-win.server.ntlworld.com.POSTED!not-for-mail From: "chris.danx" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-gb, en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Style: always declare subrountines? References: <3dccc023$0$304$bed64819@news.gradwell.net> In-Reply-To: <3dccc023$0$304$bed64819@news.gradwell.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Inktomi-Trace: pc2-bbrg1-4-cust108.renf.cable.ntl.com 1036859370 4183 80.4.70.108 (9 Nov 2002 16:29:30 GMT) Message-ID: Date: Sat, 09 Nov 2002 16:28:16 +0000 NNTP-Posting-Host: 80.1.224.5 X-Complaints-To: abuse@ntlworld.com X-Trace: news13-win.server.ntlworld.com 1036859371 80.1.224.5 (Sat, 09 Nov 2002 16:29:31 GMT) NNTP-Posting-Date: Sat, 09 Nov 2002 16:29:31 GMT Organization: ntl News Service Xref: archiver1.google.com comp.lang.ada:30656 Date: 2002-11-09T16:28:16+00:00 List-Id: Victor Porton wrote: > How do you consider this: > > If one would always declare every subrountine of a package body in the > specification (in the public or in the private part) this excludes the > possibility that one may mistakedly create an internal subrountine > with the same specification as a not yet implemented public procedure > and forget to implement this public procedure and so get wrong program > behavior. I don't see the problem, surely you would have to put the public routines code in the body and therefore be aware of the naming of the public routines? > > Stylistic checkers for always declaring in package specification? I almost never do this. I only put the interface routines in the spec and put auxilliary routines in the body only. This helps separate as much as possible the implementation and the specification. As always there is an exception to this. Whenever I have a controlled or limited_controlled type, I like to put the adjust, initialize and finalize routine declarations in the private section of the spec. Just a preference I'd often like to completely separate the interface and specification almost entirely, but that's not possible in Ada. In fact I don't know a language in which it is possible to do this. It's probably a concession to compilers or something where they have to know the implementation details of a private type to know what they're doing, or to make it easier for them. It's not a big deal though! Danx -- for personal replies change spamoff to chris