comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: code partitioning (was: Future with Ada)
Date: Sun, 17 Mar 2002 19:41:26 GMT
Date: 2002-03-17T19:41:26+00:00	[thread overview]
Message-ID: <wccy9grgexl.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1016371173.685267@ananke.eclipse.net.uk

"Nick Williams" <nickw@acm.org> writes:

> Well, the reason for having labels on loops is fairly clear; to allow an
> exit statement to exit from a loop other than the innermost enclosing one.
> So there's obviously a concrete 'why' for loops - its not as clear for
> blocks (although I can see that it might be nice to have a construct which
> allows a new declarative region to be nameable).

I think the reason blocks can have names is so you can use them in
expanded names -- eg Block_Name.Object_In_Block.  Hardly essential, but
it seems like a nice property.  I think the 1983 RM has a note pointing
out that if you name all your blocks, you can always refer to anything
via a full expanded name (assuming Standard is not hidden).  This
implies that JDI thought this was a nice property for the language to
have.

I never put a name on a loop, unless there is an exit that refers to
that name.  And such an exit is always nested inside another loop.
That is, the existence of the name lets the reader know that something
unusual is going on (an exit from a more-nested loop) -- assuming the
reader knows I'm using this style, of course.

The visibility rules for these things are weird, especially if you
compare them to loop parameters.  The compiler has to jump through some
annoying hoops.  For example:

    procedure P is
    begin
        for X in 1..10 loop

            X: -- Illegal; loop name X is not visible here.
		while ... loop
		    null;
		end loop X;
        end loop;
    end P;

- Bob



  reply	other threads:[~2002-03-17 19:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-14  5:41 code partitioning (was: Future with Ada) Christoph Grein
2002-03-16 15:46 ` Jacob Sparre Andersen
2002-03-17 13:19 ` Nick Williams
2002-03-17 19:41   ` Robert A Duff [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-03-13  6:09 Christoph Grein
2002-03-13 11:50 ` Larry Kilgallen
2002-03-13 14:15   ` Wes Groleau
2002-03-13 15:21   ` Kevin Cline
2002-03-13 15:24   ` Pascal Obry
2002-03-13 14:11 ` Wes Groleau
2001-11-09 17:59 Future with Ada Michal Nowak
2002-02-26  4:12 ` Jim Rogers
2002-02-27 17:51   ` Warren W. Gay VE3WWG
2002-02-28 17:45     ` Michal Nowak
2002-02-28 18:53       ` Hyman Rosen
2002-03-01 17:26         ` Jeffrey Carter
2002-03-03  8:26           ` Hyman Rosen
2002-03-03 17:47             ` Chad R. Meiners
2002-03-04 16:30               ` Hyman Rosen
2002-03-05  1:41                 ` Richard Riehle
2002-03-05 21:35                   ` Wes Groleau
2002-03-05 22:04                     ` Marin David Condic
2002-03-06 16:36                       ` Georg Bauhaus
2002-03-06 17:27                         ` Marin David Condic
2002-03-07 16:04                           ` Georg Bauhaus
2002-03-07 16:42                             ` Marin David Condic
2002-03-11 20:02                               ` Wes Groleau
2002-03-11 23:56                                 ` Marin David Condic
2002-03-12 16:47                                   ` code partitioning (was: Future with Ada) Wes Groleau
2002-03-12 17:56                                     ` Marin David Condic
2002-03-14 15:27                                       ` John R. Strohm
2002-03-15 14:15                                         ` Ted Dennison
2002-03-16 10:37                                           ` Kevin Cline
replies disabled

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