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: dennison@telepath.com Subject: Re: Dynamicly declaring arrays (was: Time to join the fold?) Date: 1999/02/02 Message-ID: <797esn$gbd$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 439817099 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> <7973lb$mdl$1@remarQ.com> X-Http-Proxy: 1.0 x14.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Tue Feb 02 18:07:28 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1999-02-02T00:00:00+00:00 List-Id: In article <7973lb$mdl$1@remarQ.com>, "news.oxy.com" wrote: > 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. I tend to find when I need this feature there is also some conceptual detail that could be abstracted away as well, so I'll just create a new subroutine. Its very rare that I write a routine with more than about 10 semi's from "begin" to "end". Assuming it can be inlined, I don't see where I loose anything by using a subroutine over a declare block. There are additionally several advantages to subroutines, both conceptually and syntacticly. > > 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 That's a pretty good one. I don't do "use" clauses, but blocks could be useful for "use types" (or in Ada83, operator function renames). > 2. To locally rename long packages and function names and create local > instances of generic packages. I don't like to use renames. Its one more thing for the poor sap trying to figure out my code to keep track of. But I suppose localizing the renames would lessen the problem a tad. > 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; Bingo! That's a good one. I do have one example in code I wrote recently that does just that. > 4. To define local exception handlers within block. That's one use of them I do need quite a bit (but technicly, those are just "begin...end" blocks :-) ). T.E.D. (please don't flame me; I'm just looking to improve my technique.) -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own