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,96ae138aab3beb03 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-16 16:35:16 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!nyc.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Localized Variable Declaration Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Sun, 16 Jun 2002 23:34:27 GMT References: <3CF77998.9040806@yahoo.com> <3CF77CDA.3090805@yahoo.com> <3CF78D3D.3030400@yahoo.com> <3CF79DFC.50613FAF@san.rr.com> <5ee5b646.0206020720.6b91978b@posting.google.com> NNTP-Posting-Host: shell01.theworld.com Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:26104 Date: 2002-06-16T23:34:27+00:00 List-Id: Michael Bode writes: > dewar@gnat.com (Robert Dewar) writes: > > > So let's correct that and write something that makes the > > original point (which was valid and appropriately stated) > > with correct code in good style: > > > > > procedure .... is > > > begin > > > Put_Line("write two numbers"); > > > declare > > > a : constant Integer := Read (...); > > > b : constant Integer := Read (...); > > > c : constant Float := Float (a) * Float (b) * 42.42; > > > begin > > > Put_Line ("answer = " & Float'Image (c)); > > > end; > > > end ....; > > Could someone please help a poor Ada beginner and tell me when to > leave a blank between a function name and its parameter list and when > not? I personally find the above Put_Line("write two number"); more > readable than Float := Float (a) * Float (b) * 42.42; because I think > of a function and its parameters as a unity, but I've seen the blanks > in textbooks quite often. OTHO "Ada Quality and Style" favors the > Put_Line(...) There is no universal agreement on this. I suspect Robert meant to put a blank after Put_Line, above, because that's the GNAT style. The Ada RM style is not to put a blank before the "(". The GNAT style is to put in that blank. I find the GNAT style ugly, particularly when there's a selected component: ... Get_Something(X, Y).Some_Component ... in the GNAT style would be: ... Get_Something (X, Y).Some_Component ... which makes it look like ".Some_Component" is being applied to "(X, Y)", whereas it is actually being applied to "Get_Something(X, Y)". Not a big deal. ;-) > PS: No Holy War intended. ;-) These kinds of trivialities are what holy wars are made of! - Bob