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-05-31 10:04:59 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!newsfeed.cwix.com!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Localized Variable Declaration Date: 31 May 2002 12:04:05 -0600 Organization: LJK Software Message-ID: References: <3CF77998.9040806@yahoo.com> <3CF77CDA.3090805@yahoo.com> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1022864647 21849 192.135.80.34 (31 May 2002 17:04:07 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Fri, 31 May 2002 17:04:07 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:25103 Date: 2002-05-31T12:04:05-06:00 List-Id: In article , "martin.m.dowie" writes: > "David Rasmussen" wrote in message > news:3CF77CDA.3090805@yahoo.com... >> Oh sure, but that is pretty tedious, compared to just a one line >> variable declation. The point is, to be a bit extreme, that centralized >> variable declations (e.g. at the "beginning" of the function) as done in >> C and Pascal, are evil. Variables should be declared close to where they >> are needed, IMO. > > Sure, but that's what you get with a declare ... begin ... end. You also get > to delimit the scope in the example I gave there could have been 100 more > lines after the 'end' that just didn't need visibility of the local > variable. Can > you do that with a 'one line variable declaration'? procedure Blah is begin -- Blah if Some_Function then declare Local_Variable : Integer; begin do_something; end; else end if; end Blah; Oh sure, but that is pretty tedious, compared to just a one line variable declation. The point is, to be a bit extreme, that centralized variable declations (e.g. at the "beginning" of the function) as done in C and Pascal, are evil. Variables should be declared close to where they are needed, IMO. /David