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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,791530e499e6a7f9 X-Google-Attributes: gid103376,public From: "Samuel T. Harris" Subject: Re: ada writing guide Date: 2000/04/13 Message-ID: <38F63461.91EC3625@Raytheon.com>#1/1 X-Deja-AN: 610833113 Content-Transfer-Encoding: 7bit References: <8d1rso$bir$2@bunyip.cc.uq.edu.au> <8d1vhj$hdr$1@nnrp1.deja.com> <8d2hig$7e6$1@nnrp1.deja.com> <38F5DF8C.1A01E5A4@utech.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Raytheon Aerospace Engineering Services Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-04-13T00:00:00+00:00 List-Id: "Jeffrey D. Cherry" wrote: > > Robert Dewar wrote: > > > > I find the extra ); on its own line offensive and unnatural, > > just as clear, and much easier on the eye to write > > > > > procedure Foo > > > (D : in out Data; > > > C : in Data); > > > > In GNAT we prefer to put things on a single line: > > > > > procedure Foo (D : in out Data; C : Data); > > > > If they fit comfortably on one line, and use the form with > > one line per parameter only if that is not the case. > > I quite agree that if a complete declaration can appear on one > line, it should not be arbitrarily broken up into two or more > lines. I also agree with the ");" looking silly when it's > on a line by itself. The part about "in" mode for parameters > (not quoted above, but in the original post) I would also > agree with, especially with function parameters. Now > here is where I stray ... just a bit. > > I like the following form for a subprogram declaration: > > procedure Foo( > D : in out Data; > C : in Data); > I prefer ... procedure foo ( d : in out data; -- some meaningful comment about d. c : in data -- some meaningful comment about c. ); procedure foo ( d : in out data; c : in data ) is [declarations] begin [statements] end; I find the extra white space around the parameter group natural and appealing. The comments about d and c in the subprogram specification can naturally be about the contact (a la Eiffle) assumptions. The comments about d and c in the subprogram body can be about internal assumptions or design details. -- Samuel T. Harris, Principal Engineer Raytheon, Aerospace Engineering Services "If you can make it, We can fake it!"