(j3.2006) Public Comment J32034
Jim Giles
JamesGiles-2
Wed Jul 16 15:17:40 EDT 2008
Van Snyder wrote:
> On Wed, 2008-07-16 at 11:55 -0600, Jim Giles wrote:
...
>> Given the rarity of use of the feature, even when allowed, it's
>> a good idea to call attention to nested declarations by making it
>> a separate construct. So, BLOCK is better than letting the
>> declarations just go anywhere.
>
> The problem in C (there's only one?) is that blocks are nearly
> invisible: {}.
>
> My friends who have written volumes of Ada code (e.g. the 1/3 million
> lines in orbit around Saturn) find declarations within nested blocks
> to be useful.
Correct me if I'm wrong (and I'm pretty sure I'm not since I have the
Ada (1980) standard document in my lap as I type this), but Ada
has a separate construct for such nested declarations. Like BLOCK,
it's distinct from control constructs (which can't contain declarations).
It's written:
declare
<declaration part>
begin
<sequence of statements>
end
(I changed only the presentation. The Ada document uses boldface
and other fonts for meta-language. I added the angle brackets myself.)
I didn't say BLOCK was a bad idea. I didn't oppose it in my public
comment. I said in this thread that allowing declarations in all other
block-structured constructs was a bad idea. I still think so.
Has Ada since dispensed wth the 'declare' construct and allowed
declarations all over perdition? That would indeed be a backward
step.
J. Giles
More information about the J3
mailing list