TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Tucker Taft <[log in to unmask]>
Reply To:
Tucker Taft <[log in to unmask]>
Thu, 19 Mar 1998 19:04:32 -0500
text/plain (32 lines)
During the Ada 9X process, we did investigate adding an exit-from-block
capability.  Given that you could pretty easily implement "continue"
by simply exiting from a block containing the entire loop body.

However, to remain upward compatible, we had to create somewhat
non-intuitive rules.  In particular, an unnamed exit would always
be interpreted as an exit-innermost-loop, whereas a named exit
would be allowed to exit a named block or a named loop.

Probably better would have been to have a new reserved word
(or some delightful combination of existing reserved words like
"goto end <identifier>;").

In any case, the cost/benefit ratio did not seem to justify such
clever creativity at the time.  A "structured" goto is always
available if you really need it.  E.g.:
    while ... loop
           goto continue;
     <<continue>> null;
    end loop;

Though I use various "handy" features when coding C (like "continue"
and the dreaded "hopefully-intentional-fall-through-to-next-switch-
alternative"), surprisingly I don't notice their lack when coding
in Ada.  I suppose my mind adjusts automatically to the language
in which I am writing and finds other appropriate ways
to solve a given flow-of-control problem.

-Tucker Taft  [log in to unmask]