TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Proportional Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Mike Kamrad <[log in to unmask]>
Fri, 20 Mar 1998 09:17:31 -0500
text/plain (43 lines)
At 06:54 PM 3/19/98 -0600, Randy Brukardt wrote:
>>> >While we're in the same general area, why wasn't the exit statement
>>> >permitted to exit a block statement?
>>>
>>> Having spent a lot of effort to get this to work, I can assure that
>there
>>> is no such limitation in Ada 83 or in Ada 95.
>>
>>I think you may have misinterpreted the question.
>>
>>I suspect the question was why can't you use "exit foo;" to go to
>>the statement immediately following the end of the enclosing block
>>named foo, since blocks can have labels just like loops?
>>
>>I.e., why is "exit" only defined for loops?
>
>Having seen your answer, I think you are correct.
>
>I think of a block more or less like an if statement, and I don't think in
>terms of "exiting" such things.  (Loops are special; you have to break the
>iteration somehow, or you go on forever.)  What you're thinking of is more
>like "return" to me, but calling it that wouldn't be possible.
>
>In any case, I think we both agree that such things aren't worth the
>effort.  A few well-placed Gotos handle the rare cases where this is
>useful.
>
>Having said how useless I find a block exit statement, I just noticed that
>all 5 gotos in Claw (to two labels) are essentially block exits.  The
>labels are on the line after the end of a block, and
>the gotos go there.  Perhaps it would have been useful!  :)

That was the point of my question, Randy...mike



------------------------------------------------------
Mike Kamrad                             [log in to unmask]
BlazeNet                                1.508.370.4343 x139
Suite 300                               1.508.370.4344 FAX
1671 Worcester Road
Framingham MA 01701

ATOM RSS1 RSS2