TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

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

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

Print Reply
Subject:
From:
Toshitaka KUMANO <[log in to unmask]>
Reply To:
Toshitaka KUMANO <[log in to unmask]>
Date:
Thu, 23 Aug 2001 15:48:18 +0900
Content-Type:
text/plain
Parts/Attachments:
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