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,4873305131bf4d94 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,4873305131bf4d94 X-Google-Attributes: gid1014db,public From: Jon S Anthony Subject: Re: Porting (was ADA and Pascal etc) Date: 1997/11/03 Message-ID: #1/1 X-Deja-AN: 286843107 Distribution: world References: <34557f2b.1934172@news.mindspring.com> <63bhta$g2e@bgtnsc03.worldnet.att.net> <345AB871.413A@dynamite.com.au> <63d5l4$tub$1@helios.crest.nt.com> <878495810snz@genesis.demon.co.uk> Organization: PSINet Newsgroups: comp.lang.ada,comp.lang.c Date: 1997-11-03T00:00:00+00:00 List-Id: fred@genesis.demon.co.uk (Lawrence Kirby) writes: > In article <63d5l4$tub$1@helios.crest.nt.com> > kaz@helios.crest.nt.com "Kaz Kylheku" writes: ... > >Ada makes so much more sense by requiring data declarations to precede the > >function body. Only scatter-brained programmers see a stylistic advantage in > >declarations interspersed with statements. > > Perhaps I'm scatter-brained. I see advantage for locality of scope. This > also helps in specifying invariants with careful use of const. Actually, Ada supports this just fine. But it does require that you explicitly note such declarations: function Foo (...) return ... is -- some local declarations preceding the body... begin ... blah blah blah using the above declarations declare -- some declarations used for only the following code block... begin ... use the more localized declarations and ... possibly the outer ones as well end; ... the above declare block decls no longer available end Foo; The declarations in the declare block can be basically anything, including generic instantiations, packages, tasks, dynamically sized objects, etc. > Of course it is not necessary but it can be very beneficial when used > sensibly. Fair enough. Just note it is completely supported in Ada... /Jon -- Jon Anthony Synquiry Technologies, Ltd., Belmont, MA 02178, 617.484.3383 "Nightmares - Ha! The way my life's been going lately, Who'd notice?" -- Londo Mollari