From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,92c39a3be0a7f17d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-17 11:42:37 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-hub.siol.net!zur.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: code partitioning (was: Future with Ada) Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Sun, 17 Mar 2002 19:41:26 GMT References: <1016371173.685267@ananke.eclipse.net.uk> NNTP-Posting-Host: shell01.theworld.com Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:21375 Date: 2002-03-17T19:41:26+00:00 List-Id: "Nick Williams" 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