comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: some questions re. Ada/GNAT from a C++/GCC user
Date: 1996/04/01
Date: 1996-04-01T00:00:00+00:00	[thread overview]
Message-ID: <Dp6xF4.E4o@world.std.com> (raw)
In-Reply-To: 4jmuj5$lkh@dayuc.dayton.saic.com

In article <4jmuj5$lkh@dayuc.dayton.saic.com>,
John G. Volan  <John_Volan@ccmail.dayton.saic.com> wrote:
>Okay, then, can anybody who was in on the Ada83/Ada95 design process
>give us a more comprehensive rationale for this strict separation, one
>consequence of which being the need for declare statements?

I was in on the Ada 95 design process, and the reason is simple: It was
like that in Ada 83, and there was no mandate to change it.

I was not in on the Ada 83 design, but I suspect it has something to do
with the Pascal heritage.  Also, some people have said they find it
easier to read the code if they can find the declarations.  I don't
really agree with that, but I suppose it's mainly a matter of taste.

>    -- This is NOT Ada, this is CRAPOLA (C-Reminiscent Ada-like Perversion
>    -- Of Language Aspects)  :-) :

Now, now.  I see the smiley, but still, this is just an ad-hominem
attack.

>    begin
>        ...
>        if Smaller then
>            X : Integer;
>            ...
>        elsif Bigger then
>            X : Long_Integer;
>            ...
>        end if;
>        ...
>        -- is X in scope here, and if so, what the heck is it?

No, X is not in scope here.  There are two things called X, and their
scopes do not overlap.  The first X starts to exist at the beginning of
the 'then' part, and ceases to exist at the end of that statement list.

The semantics of CRAPOLA should be exactly the same as if, in Ada, you
put declare-begin-end:

        if Smaller then
            declare
                X : Integer;
            begin
                ...
            end;
        elsif Bigger then
            declare
	        X : Long_Integer;
            begin
                ...
            end;
        end if;

>        ... loop
>            Y : Integer;
>            Get (Y);
>            type A is array (1 .. Y) of Integer;
>            package P is new Generic_P (A);
>            -- do these things get elaborated & destroyed every iteration?

Yes.  And if any of the declarations need finalization, they will get
finalized at the end of each iteration.

>            ...
>        end loop ... ;
>        ...
>        -- are Y, A, and P still in scope here?

No.

>    end ... ;

>I assume that the only thing that would make sense would be to treat
>every structured statement as the moral equivalent of a begin/end.

You assume right.  That is, we're arguing about syntactic sugar; the
semantics doesn't change if you allow declare-begin-end to be left out.

- Bob




  parent reply	other threads:[~1996-04-01  0:00 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-27  0:00 some questions re. Ada/GNAT from a C++/GCC user Bill Newman
1996-03-27  0:00 ` Robert Dewar
1996-03-28  0:00   ` Brian Rogoff
1996-03-29  0:00     ` John G. Volan
1996-03-30  0:00       ` Robert A Duff
1996-03-31  0:00         ` Robert Dewar
1996-04-01  0:00           ` Norman H. Cohen
1996-03-31  0:00         ` John G. Volan
1996-03-31  0:00           ` Mike Young
1996-04-02  0:00             ` Glenn H. Porter
1996-04-02  0:00               ` Jonas Nygren
1996-04-02  0:00               ` Robert Dewar
1996-04-03  0:00               ` Geert Bosch
1996-04-03  0:00                 ` Robert Dewar
1996-04-01  0:00           ` Bruce.Conroy
1996-04-01  0:00           ` Robert A Duff [this message]
1996-04-03  0:00             ` Scott Leschke
1996-04-04  0:00               ` AdaWorks
1996-03-30  0:00       ` Mike Young
1996-03-30  0:00         ` Ted Dennison
1996-03-31  0:00           ` Mike Young
1996-04-01  0:00       ` Norman H. Cohen
1996-04-01  0:00         ` Mike Young
1996-04-02  0:00           ` Norman H. Cohen
1996-04-02  0:00           ` David Shochat
1996-04-02  0:00             ` Mike Young
1996-04-02  0:00           ` Robert Dewar
1996-04-01  0:00         ` Robert A Duff
1996-04-01  0:00           ` Mike Young
1996-04-02  0:00             ` Norman H. Cohen
1996-04-02  0:00             ` Robert A Duff
1996-03-28  0:00   ` Norman H. Cohen
1996-03-28  0:00 ` Ted Dennison
1996-03-29  0:00   ` Adam Beneschan
1996-03-28  0:00 ` Scott Leschke
1996-03-29  0:00   ` Robert A Duff
1996-03-30  0:00     ` Richard Pitre
1996-03-30  0:00       ` Robert A Duff
1996-03-31  0:00         ` AdaWorks
1996-04-01  0:00           ` Robert A Duff
1996-04-01  0:00             ` AdaWorks
1996-04-01  0:00               ` Mike Young
1996-04-02  0:00                 ` AdaWorks
1996-04-02  0:00                 ` Robert Dewar
1996-04-01  0:00             ` Norman H. Cohen
1996-04-01  0:00             ` Ken Garlington
1996-04-01  0:00               ` Robert A Duff
1996-04-02  0:00                 ` Ken Garlington
1996-04-02  0:00                   ` Robert A Duff
1996-04-02  0:00                     ` Ken Garlington
1996-04-02  0:00                       ` Robert A Duff
1996-04-03  0:00                         ` David Emery
1996-04-03  0:00                         ` Ken Garlington
1996-04-09  0:00                           ` Matt Kennel
1996-04-02  0:00                 ` Tucker Taft
1996-04-02  0:00                   ` Felaco
1996-04-02  0:00                     ` Robert Dewar
1996-04-03  0:00                     ` Mark A Biggar
1996-04-01  0:00         ` Richard A. O'Keefe
1996-04-01  0:00           ` Robert A Duff
1996-04-01  0:00         ` Robert Dewar
1996-04-02  0:00       ` Robert I. Eachus
1996-03-29  0:00   ` Robert I. Eachus
1996-03-29  0:00   ` Bill Newman
1996-03-29  0:00 ` Robert A Duff
1996-03-29  0:00   ` Brian Rogoff
1996-04-01  0:00     ` Mark A Biggar
1996-04-01  0:00       ` Robert A Duff
1996-03-30  0:00   ` Iterators (was Re: some questions re. Ada/GNAT from a C++/GCC user) Robert I. Eachus
1996-03-31  0:00     ` Mike Young
1996-03-31  0:00       ` Fergus Henderson
     [not found]   ` <4jlj79$h1k@Nntp1.mcs.net>
1996-04-01  0:00     ` some questions re. Ada/GNAT from a C++/GCC user Robert A Duff
1996-04-02  0:00       ` Kevin Cline
1996-04-02  0:00         ` Robert A Duff
1996-04-01  0:00   ` Iterators (was Re: some questions re. Ada/GNAT from a C++/GCC user) Robert I. Eachus
1996-04-04  0:00   ` some questions re. Ada/GNAT from a C++/GCC user Jon S Anthony
1996-03-30  0:00 ` Simon Wright
1996-04-01  0:00 ` Laurent Guerby
1996-04-01  0:00   ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1996-03-28  0:00 Simon Johnston
replies disabled

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