TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

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

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

Print Reply
Toshitaka KUMANO <[log in to unmask]>
Thu, 23 Aug 2001 15:48:18 +0900
text/plain (52 lines)
Hello Team Ada,

This is a proposal of extension to Ada, simply about syntax of "when".

Any comments ?

Excuse me if this is one of discussed issues.

-----------------------------------------------------------------------
Proposal :

I am an enthusiast for the concise syntax in Ada, "exit when".

My proposal is that the "when", which is an alternative of "if then",
is available also in "raise" and "return".

-----------------------------------------------------------------------
Merit :

Such codes below are frequent in programs.

if Found_Error then
   raise Some_Exception;
end if;
...
if No_Need_Go_Further then
   return [Value];       --  function/procedure
end if;

And successive or nested use of these statements occasionally
makes programs difficult to understand.


So, if we can write  "raise when" and "return when", we make codes
more readable, such as,

 raise Some_Exception when Found_Error;
 ...
 return [Value] when No_Need_Go_Further;

These syntax looks like consistent to

 exit [Loop_Lavel] when Some_Condition;


And the behavior, "some escape", is common among these three.

Regards,
--
------------------------------------------------------------------------
   Toshitaka KUMANO <[log in to unmask]>

ATOM RSS1 RSS2