comp.lang.ada
 help / color / mirror / Atom feed
From: dennison@telepath.com
Subject: Re: Dynamicly declaring arrays (was: Time to join the fold?)
Date: 1999/02/02
Date: 1999-02-02T00:00:00+00:00	[thread overview]
Message-ID: <797esn$gbd$1@nnrp1.dejanews.com> (raw)
In-Reply-To: 7973lb$mdl$1@remarQ.com

In article <7973lb$mdl$1@remarQ.com>,
  "news.oxy.com" <Vladimir_Olensky@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    




  parent reply	other threads:[~1999-02-02  0:00 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-22  0:00 Time to join the fold? Mike Silva
1999-01-22  0:00 ` Tucker Taft
1999-01-25  0:00   ` Mike Silva
1999-01-25  0:00     ` robert_dewar
1999-02-02  0:00       ` news.oxy.com
1999-01-25  0:00     ` Pat Rogers
1999-01-25  0:00     ` dennison
1999-01-31  0:00       ` Matthew Heaney
1999-02-01  0:00         ` Dynamicly declaring arrays (was: Time to join the fold?) dennison
1999-02-01  0:00           ` Matthew Heaney
1999-02-01  0:00           ` Larry Kilgallen
1999-02-02  0:00           ` robert_dewar
1999-02-02  0:00             ` news.oxy.com
1999-02-02  0:00               ` nabbasi
1999-02-02  0:00                 ` dennison
1999-02-02  0:00                   ` robert_dewar
1999-02-02  0:00                     ` William Clodius
1999-02-03  0:00                       ` Robert A Duff
1999-02-03  0:00                         ` Modula 2 William Clodius
1999-02-02  0:00                     ` Dynamicly declaring arrays (was: Time to join the fold?) Al Christians
1999-02-02  0:00                     ` dennison
1999-02-02  0:00               ` robert_dewar
1999-02-03  0:00                 ` news.oxy.com
1999-02-03  0:00                   ` Robert I. Eachus
1999-02-04  0:00                   ` M2 history - relations to Ada news.oxy.com
1999-02-04  0:00                     ` robert_dewar
1999-02-04  0:00                     ` Chuck Clark
1999-02-10  0:00                       ` Andreas Borchert
1999-02-04  0:00                     ` David C. Hoos, Sr.
1999-02-04  0:00                       ` Aron Felix Gurski
1999-02-05  0:00                         ` Robert Lanziner-Furtenbach
1999-02-04  0:00                           ` David C. Hoos, Sr.
1999-02-05  0:00                           ` Robert Lanziner-Furtenbach
1999-02-04  0:00                       ` Chris Morgan
1999-02-04  0:00                         ` Jerry van Dijk
1999-02-05  0:00                         ` Grant Edwards
1999-02-04  0:00                       ` news.oxy.com
1999-02-04  0:00                         ` Jean-Pierre Rosen
1999-02-04  0:00                         ` G.S. Vigneault
1999-02-02  0:00               ` dennison [this message]
1999-01-26  0:00     ` Time to join the fold? Jean-Pierre Rosen
1999-01-26  0:00       ` dennison
1999-01-26  0:00         ` Pascal MALAISE
1999-01-27  0:00     ` Steve Whalen
1999-02-01  0:00       ` Robert I. Eachus
1999-01-23  0:00 ` Steve Whalen
1999-01-23  0:00   ` Tom Moran
1999-01-24  0:00     ` Steve Whalen
1999-01-24  0:00       ` Tom Moran
1999-01-23  0:00 ` Matthew Heaney
1999-01-23  0:00   ` Tom Moran
1999-01-24  0:00 ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox