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,f25e853f410d55da X-Google-Attributes: gid103376,public From: "news.oxy.com" Subject: Re: Dynamicly declaring arrays (was: Time to join the fold?) Date: 1999/02/02 Message-ID: <7973lb$mdl$1@remarQ.com>#1/1 X-Deja-AN: 439770665 References: <78abg4$cnc$1@its.hooked.net> <78i8s4$hth$1@its.hooked.net> <78iq2m$br9$1@nnrp1.dejanews.com> <794gg7$ib$1@nnrp1.dejanews.com> <7963q0$ail$1@nnrp1.dejanews.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: newsabuse@remarQ.com X-Trace: 917967339 HXI3FRZSOA57FC7F8C usenet54.supernews.com Organization: Posted via RemarQ, http://www.remarQ.com - Discussions start here! Newsgroups: comp.lang.ada Date: 1999-02-02T00:00:00+00:00 List-Id: robert_dewar@my-dejanews.com wrote in message <7963q0$ail$1@nnrp1.dejanews.com>... >In article <794gg7$ib$1@nnrp1.dejanews.com>, > dennison@telepath.com wrote: >> I'm not entirely sure I can defend this aversion to >> declare blocks in a rational way, so if anyone has a >> rationale as to why its perfecly acceptable to have >> declare blocks liberally sprinkled throught their code, >> I'm all ears. > >Why on earth does it need a rationale to use a feature >in the language that is obviously useful and has an ancient >and well accepted understanding as useful (blocks were >after all in Algol-60). > >THe principle of using blcoks to make temporaries as >local as possible is of course familiar to any programmer >in an algol style language. I could also mention that this was also used in Modula-2 as well (inner modules). Modula-2 had many features that later was implemented in Ada. E.g. module in Modula-2 corresponds to package in Ada, IMPORT clause in Modula-2 corresponds to WITH clause in Ada ,concept of "safe&reliable" programming, concept of hiding implementation details using module specifications e.t.c. Ability to reduce the living scope and name scope of any king of objects within large program can significantly increase the reliability of the program. Local blocks are especially useful in conjunction with some of other powerful Ada features and give you ability 1. To use USE and/or USE TYPE clauses within declaration block so you do not need to type fully qualified names and at the same time there is no possibility of names clashes within program scope 2. To locally rename long packages and function names and create local instances of generic packages. 2.1. both 1 &2 greatly increase readability of the program and show programmer intentions. 3. To declare local objects that should be deleted on exit of the block scope. This is very useful in conjunction with the use of controlled types that is used to implement some kind of user defined garbage collection; 4. To define local exception handlers within block. This list is not full. It is just short outline. The real feeling of all that things will come with time and experience. Regards, Vladimir Olensky (vladimir_olensky@yahoo.com) (Vladimir_Olensky@oxy.com) Telecommunication specialist, Occidental C.I.S. Service, Inc. ( www.oxy.com ) Moscow, Russia.