From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Dynamicly declaring arrays (was: Time to join the fold?)
Date: 1999/02/01
Date: 1999-02-01T00:00:00+00:00 [thread overview]
Message-ID: <m3lnii59wv.fsf@mheaney.ni.net> (raw)
In-Reply-To: 794gg7$ib$1@nnrp1.dejanews.com
dennison@telepath.com writes:
> In article <m3aeyz8mw1.fsf@mheaney.ni.net>,
> Matthew Heaney <matthew_heaney@acm.org> wrote:
> > dennison@telepath.com writes:
> >
> > > In a severe jam a declare block can be used to get a localized
> > > constant string, or one of the ada.strings packages can be used.
> >
> > Rather odd to describe using a declare block to declare a string object
> > only in a "severe jam," since this is the normal, intended usage!
> >
>
> True, that is what they are there for. But my style is to avoid declare
> blocks if I can help it. Typicaly I'd try to break off a proper subroutine
> first. When I do use declare blocks, its usually just to provide a localized
> exception handler (and in that case of course the "declare" isn't nessecary).
>
> 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.
The purpose of a declare block is to localize an object declaration, so you
can minimize the distance between the declaration of object and its
actual use.
The purpose of a subprogram is algorithmic abstraction. A declare block
is not an abstraction of an algorithm.
I do "liberally sprinkle my code" with declare blocks, especially for
declaring the result of a function that returns an unconstrained array
(i.e. string). This localizes the object, and avoids an assignment of a
string value to a string object, so there won't be any length mismatch
problems.
The point of this thread is about how to effect an ada mind-set. The
liberal use of declare blocks is a common Ada idiom.
next prev parent reply other threads:[~1999-02-01 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 ` 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 ` Larry Kilgallen
1999-02-01 0:00 ` Matthew Heaney [this message]
1999-02-02 0:00 ` robert_dewar
1999-02-02 0:00 ` news.oxy.com
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 ` 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 ` G.S. Vigneault
1999-02-04 0:00 ` Jean-Pierre Rosen
1999-02-04 0:00 ` Chuck Clark
1999-02-10 0:00 ` Andreas Borchert
1999-02-02 0:00 ` Dynamicly declaring arrays (was: Time to join the fold?) nabbasi
1999-02-02 0:00 ` dennison
1999-02-02 0:00 ` robert_dewar
1999-02-02 0:00 ` dennison
1999-02-02 0:00 ` Al Christians
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?) dennison
1999-01-25 0:00 ` Time to join the fold? robert_dewar
1999-02-02 0:00 ` news.oxy.com
1999-01-25 0:00 ` Pat Rogers
1999-01-26 0:00 ` 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 ` Matthew Heaney
1999-01-23 0:00 ` Tom Moran
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-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