comp.lang.ada
 help / color / mirror / Atom feed
From: Philip Anderson <phil.anderson@amsjv.com>
Subject: Re: exiting a bloc
Date: Wed, 06 Sep 2000 10:41:31 +0100
Date: 2000-09-06T10:41:31+01:00	[thread overview]
Message-ID: <39B6114B.2929FA58@amsjv.com> (raw)
In-Reply-To: 39B5A8B0.56D674C6@telepath.com

Ted Dennison wrote:
>  
> I know I pretty much follow that rule myself. But I'm not sure I'd like to
> see it elevated to Law. I do occasionaly like to use "declare" for sizing
> arrays (particularly strings) dynamicly on the stack. I think I've also used
> them in the "accept" alternatives of server tasks or in branches of large
> command-processing case statements to declare local variables that are
> unique to that alternative.
> 
> About the only other reason I ever use a declare is to declare local
> variables that are used in the exception code of a block's exception
> handler. It'd be a bit excessive to create a new routine just because the
> exception handler needs a variable. It makes sense to limit the variable's
> scope to the block, since that's the only place its used and the block is
> already there.

I'd agree with that in general, but it's a not unreasonable restriction
to impose if restrictions are being imposed.

Declare blocks are excluded in SPARK, and it makes sense there; most of
the situations where you and I might use it are not applicable in SPARK
anyway - no dynamic arrays, tasks or exceptions.  Branches of case
statements could arise, but it would seem more readable to call a
procedure if one is that complicated.


-- 
hwyl/cheers,
Philip Anderson
Alenia Marconi Systems
Cwmbr�n, Cymru/Wales



  reply	other threads:[~2000-09-06  9:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-02 20:10 exiting a bloc Mathias Dolidon
2000-09-02 20:39 ` Mathias Dolidon
2000-09-02 21:01 ` Robert Dewar
2000-09-02 22:34   ` Mathias Dolidon
     [not found]     ` <86snrhkfep.fsf@acm.org>
2000-09-03 15:46       ` Mathias Dolidon
2000-09-05 17:52   ` Richard Riehle
2000-09-06  2:06     ` Ted Dennison
2000-09-06  9:41       ` Philip Anderson [this message]
2000-09-06 13:54         ` Ted Dennison
2000-09-06 21:10           ` Robert Dewar
2000-09-06 23:33             ` Ed Falis
2000-09-07  0:39               ` Robert Dewar
     [not found]               ` <39B72109.89DFAB8C@telepath.com>
2000-09-07 12:34                 ` Ed Falis
2000-09-08 10:33                   ` Ian Caldwell
2000-09-08 13:35                     ` r_c_chapman
2000-09-09  1:52                       ` Robert Dewar
2000-09-12 11:30                       ` Ian Caldwell
2000-09-12 20:13                         ` Robert Dewar
2000-09-09  1:48                     ` Robert Dewar
2000-09-12 11:24                       ` Ian Caldwell
2000-09-12 20:14                         ` Robert Dewar
2000-09-13  8:34                           ` Philip Anderson
2000-09-13 11:02                             ` Peter Amey
2000-09-06  7:00     ` Ray Blaak
replies disabled

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